I currently have a machine connected to a LAN and to the internet working fine.
I now got a dedicated connection to a remote office and must create a route from my machine to specifically 1 machine on the new office, but it must go over the dedicated line (not over the internet).
My machine has CentOS release 5.6
.
Here is a diagram of my current setup (i cant post pics here yet)
Basically from "MyServer" using eth0 to the Internet it works. eth0 has the following config.
root@MyServer:/etc/sysconfig/network-scripts $ more ifcfg-eth0
# Intel Corporation 82578DC Gigabit Network Connection
DEVICE=eth0
BOOTPROTO=none
HWADDR=71:72:bd:ae:1f:49
ONBOOT=yes
DHCP_HOSTNAME=MyServer.local
IPADDR=192.168.3.11
NETMASK=255.255.255.0
GATEWAY=192.168.3.1
TYPE=Ethernet
root@MyServer:/etc/sysconfig/network-scripts $
and now I have to create an alias on eth0 and route it to "TARGET server". So what I have done is create a file named eth0:0 with the following:
root@MyServer:/etc/sysconfig/network-scripts $ more ifcfg-eth0:0
# Intel Corporation 82578DC Gigabit Network Connection
DEVICE=eth0:0
BOOTPROTO=none
HWADDR=71:72:bd:ae:1f:49
ONBOOT=yes
DHCP_HOSTNAME=MyServer.local
IPADDR=172.23.10.37
NETMASK=255.255.255.252
TYPE=Ethernet
root@MyServer:/etc/sysconfig/network-scripts $
With this alone, i can now ping 172.23.10.38
root@MyServer:/etc/sysconfig/network-scripts $ ping 172.23.10.38
PING 172.23.10.38 (172.23.10.38) 56(84) bytes of data.
64 bytes from 172.23.10.38: icmp_seq=1 ttl=255 time=6.30 ms
64 bytes from 172.23.10.38: icmp_seq=2 ttl=255 time=2.07 ms
64 bytes from 172.23.10.38: icmp_seq=3 ttl=255 time=3.13 ms
--- 172.23.10.38 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 2.071/3.839/6.309/1.801 ms
root@MyServer:/etc/sysconfig/network-scripts $
But my objective is to reach 192.168.1.96 and to reach there with a source IP address of 172.23.10.37
So i added the following route
root@MyServer:/etc/sysconfig/network-scripts $ route add -host 192.168.1.96 eth0:0
root@MyServer:/etc/sysconfig/network-scripts $ ip route list
192.168.1.96 dev eth0 scope link src 172.23.10.37
172.23.10.36/30 dev eth0 proto kernel scope link src 172.23.10.37
192.168.3.0/24 dev eth0 proto kernel scope link src 192.168.3.11
169.254.0.0/16 dev eth0 scope link
default via 192.168.3.1 dev eth0
root@MyServer:/etc/sysconfig/network-scripts $
or with netstat -rn
root@MyServer:/etc/sysconfig/network-scripts $ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.96 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
172.23.10.36 0.0.0.0 255.255.255.252 U 0 0 0 eth0
192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 eth0
root@MyServer:/etc/sysconfig/network-scripts $
From the route list, it seems to be set.
192.168.1.96 dev eth0 scope link src 172.23.10.37
and a traceroute 192.168.1.96
shows what to me seems that
indeed its trying to go out over eth0:0
root@MyServer:/etc/sysconfig/network-scripts $ traceroute 192.168.1.96
traceroute to 192.168.1.96 (192.168.1.96), 30 hops max, 40 byte packets
1 172.23.10.37 (172.23.10.37) 3001.699 ms !H 3001.698 ms !H 3001.693 ms !H
root@MyServer:/etc/sysconfig/network-scripts $
but as you can see the host is unreachable. The people that admin the remote server have guaranteed to me that their machine does respond to pings, and on my side, iptables for the time being is stopped just to be sure there are no external variables. Also, the firewall service on the router/firewall between us is stopped for the time being.
So basically I have 2 questions.
1) what am I doing wrong?
2) once I get it to work, how do I change the temporary route add -host 192.168.1.96 eth0:0
command into a persistent route? i was reading that the cleanest way to do this is adding a file called /etc/sysconfig/network-scripts/route-eth0:0
with the following line
192.168.1.96 via 172.23.10.37 dev eth0:0
is this correct?
Hopefully I have provided enough info to debug this. thanks, -gk