Network routing help

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Network routing help

Post by Chris Corbyn »

Code: Select all

w3style.co.uk:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 02:16:3E:A4:5E:75  
          inet addr:217.147.94.117  Bcast:217.147.94.255  Mask:255.255.255.0
          inet6 addr: fe80::16:3eff:fea4:5e75/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1417 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1334 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:164907 (161.0 KiB)  TX bytes:812279 (793.2 KiB)

eth0:0    Link encap:Ethernet  HWaddr 02:16:3E:A4:5E:75  
          inet addr:217.147.94.71  Bcast:217.147.94.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:1    Link encap:Ethernet  HWaddr 02:16:3E:A4:5E:75  
          inet addr:217.147.94.70  Bcast:217.147.94.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:2    Link encap:Ethernet  HWaddr 02:16:3E:A4:5E:75  
          inet addr:217.147.94.69  Bcast:217.147.94.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:176091 errors:0 dropped:0 overruns:0 frame:0
          TX packets:176091 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:100342245 (95.6 MiB)  TX bytes:100342245 (95.6 MiB)

w3style.co.uk:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
217.147.94.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         217.147.94.1    0.0.0.0         UG    0      0        0 eth0
0.0.0.0         217.147.94.1    0.0.0.0         UG    0      0        0 eth0
0.0.0.0         217.147.94.1    0.0.0.0         UG    0      0        0 eth0
0.0.0.0         217.147.94.1    0.0.0.0         UG    0      0        0 eth0
w3style.co.uk:~#
That's my network as it is. 1 main IP ending in 117, 3 other IPs ending in 69, 70, and 71. When my server makes connections outbound, any remote server sees me as 217.147.94.69. I actually want to be seen as 217.147.94.117. I'm not sure what I need to do with routing to allow this. The 3 IPs which don't end in 117 are just aliased to eth0 so all traffic goes through eth0 either way.

Would this work?

Code: Select all

route add default gw 217.147.94.117
EDIT | No, I just tried that line and it killed my network. Lucky I have a serial console open too :oops:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Netmask on the aliased interface eth0:0 through eth0:2 needed to be set to netmask 255.255.255.255 (as opposed to 255.255.255.0). Default gateway removed from all interfaces apart from the one I want to get onto the web with. Problem solved :)

Code: Select all

w3style.co.uk:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 02:16:3E:A4:5E:75  
          inet addr:217.147.94.117  Bcast:217.147.94.255  Mask:255.255.255.0
          inet6 addr: fe80::16:3eff:fea4:5e75/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1665 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1326 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:190661 (186.1 KiB)  TX bytes:795736 (777.0 KiB)

eth0:0    Link encap:Ethernet  HWaddr 02:16:3E:A4:5E:75  
          inet addr:217.147.94.71  Bcast:217.147.94.255  Mask:255.255.255.255
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:1    Link encap:Ethernet  HWaddr 02:16:3E:A4:5E:75  
          inet addr:217.147.94.70  Bcast:217.147.94.255  Mask:255.255.255.255
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:2    Link encap:Ethernet  HWaddr 02:16:3E:A4:5E:75  
          inet addr:217.147.94.69  Bcast:217.147.94.255  Mask:255.255.255.255
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:183726 errors:0 dropped:0 overruns:0 frame:0
          TX packets:183726 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:104114530 (99.2 MiB)  TX bytes:104114530 (99.2 MiB)

w3style.co.uk:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
217.147.94.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         217.147.94.1    0.0.0.0         UG    0      0        0 eth0
w3style.co.uk:~#
Might come in useful for someone else, although it does seem incredibly elementary now I think about it :oops:
Post Reply