Well, I have finally made it work. Everything works if the script looks like ths (it works even without the 'up route' command I spoke about earlier):
------------------------------------
#!/bin/sh
INTIF="eth1"
EXTIF="eth0"
EXTIP="xxx.yyy.239.50"
/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_conntrack_irc
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT
iptables -P FORWARD DROP
iptables -F FORWARD
iptables -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
------------------------------------
There is one interesting thing, however. It so happened that the router computer I was using was also an ISPConfig server. Well, I tried the following setup and pulled all the cables except for the one coming from the ISP:
-----------------------------------
auto lo
iface lo inet loopback
# This is where the ISP cable goes:
auto eth0
iface eth0 inet static
address xxx.yyy.239.50
netmask 255.255.255.252
gateway xxx.yyy.239.49
# Leading nowhere now:
auto eth1
iface eth1 inet static
address xxx.yyy.237.49
netmask 255.255.255.240
auto eth1:0
iface eth1:0 inet static
address xxx.yyy.237.50
netmask 255.255.255.240
auto eth1:1
iface eth1:1 inet static
address xxx.yyy.237.51
netmask 255.255.255.240
...
etc for the rest of the IPs
-----------------------------------
Then I tried to add some sites via ISPConfig - and I found out that all the IPs xxx.yyy.237.49 - xxx.yyy.237.62 were accessible from the outside, and the sites worked! What's more, they worked even without the shell script displayed at the beginning of this post!
Now, however, there is another problem. There is no outbound Internet on the server. It's because the connection with a gateway is eth0, and I can't even ping anything with it, but I can ping everything with eth1, eth1:0 etc - but eth1, eth1:0 etc have no gateway!
I really wonder if it's possible to make a connection without gateway a default Internet connection
Of course my idea behind this is to get rid of the switch and make the whole setup work on one computer.
I'm also thinking about another option - what if I insert a THIRD network adapter in the router computer and then it would receive Internet via eth1 and then switch? Will it work?
Recent comments
2 days 7 hours ago
2 days 15 hours ago
2 days 18 hours ago
2 days 19 hours ago
2 days 21 hours ago
2 days 23 hours ago
3 days 29 min ago
3 days 1 hour ago
3 days 17 hours ago
3 days 18 hours ago