Configuring Centos as router with virtual interface
Hi everybody
I'm newbie in unix os so, plz, have patience...
I have this issue:
I have a physical machine with only one phisical network card and i have to connect 3 subnet
I have create 3 virtual interface
eth0:1 Link encap:Ethernet HWaddr 00:01:80:68:5A:14
inet addr:85.18.22.33 Bcast:85.18.22.63 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fdfc0000-fdfe0000
eth0:2 Link encap:Ethernet HWaddr 00:01:80:68:5A:14
inet addr:217.153.107.1 Bcast:217.153.107.31 Mask:255.255.255.224
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fdfc0000-fdfe0000
eth0:3 Link encap:Ethernet HWaddr 00:01:80:68:5A:14
inet addr:192.168.141.4 Bcast:192.168.141.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fdfc0000-fdfe0000
connected on layer 2 switch where the network that have access on internet is eth0:3
I have enabled kernel routing in sysclt.cnf
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
and set
iptables -t nat -A POSTROUTING -o eth0:3 -j MASQUERADE
but when i try to connect from a machine on network on eth0:1 to eth0:2 , router put me on real Internet althought routin is as follow
217.153.107.0 * 255.255.255.224 U 0 0 0 eth0
85.18.22.32 * 255.255.255.224 U 0 0 0 eth0
192.168.141.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 192.168.141.1 0.0.0.0 UG 0 0 0 eth0
At the end, i would like that machine in network on eth0:1 will no nated on network on eth0:2 but machine on network on eth0:1 and eth0:2 must be nated on eth0:3 because they have to access to real ineternet
Any ideas ?
Thanks for all
PS OS is a CentOS 6
|