iptable setup script help
test_tube_tony
Dallas TX Member
i have this script that sets up two internet connections with load balancing on my smoothwall router. the script is set up to use 2 dhcp connections on the internet interfaces. i need to know what to change in the script to make it use two static ip addys. the script can be found here. please help. i only have about 3 or 4 days left with the old dsl connection.
0
Comments
what kernel/platform are you on?
well first off you'll have to get rid of anything DHCP in that perl script. for starters this function:
sub Kill_Links {
my $interface;
foreach $interface(@RED_DEVS) {
`ifconfig $interface down`;
`kill 'cat /etc/dhcpc/dhcpcd-$interface.pid'`;
}
return;
}
get rid of that kill command, i doubt it'll hurt but it is not necessary. next :
sub Create_Interfaces {
my ($interface, $hostname);
foreach $interface(@RED_DEVS) {
$hostname = "smoothwall2";
`/usr/local/sbin/dhcpcd -h $hostname -R $interface`;
}
return;
}
i'd change this:
`/usr/local/sbin/dhcpcd -h $hostname -R $interface`;
to something more like this:
`/usr/sbin/ifconfig $interface $static_ip netmask $subnet_mask`;
you'll have to figure out what the subnet is, and of course increment the last octet of $static_ip
and somewhere out of that foreach you'll need to set up the default gateway, which on most newer systems can't be done through if config. add a line like this:
`route add default gw $default_gw`;
ok now Modify_IPTABLES has me scratching my head.
the var $interface_type="DHCP"; is initialized early in the method as DHCP. seems to me you could try simply commenting out that assignment and see what happens when you run it, there is an if statement that checks its value anyway (however i'd highly suggest you research that, i'm not really an iptables kind of guy)
sub Create_TEQL would most likely remain unchanged