Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a virtual machine running on a public ip (eth0) and an internal IP (eth1/192.168.22.50).

From my place (192.168.110.x), I VPN to that network.

The problem is that I am unable to access any services running on that server (including ICMP) from the internal IP.

This is /etc/network/interfaces:

auto eth0
iface eth0 inet static
address 217.22.52.79
netmask 255.255.255.192
gateway 217.22.52.65

auto eth1
iface eth1 inet static
address 192.168.22.51
netmask 255.255.255.0

If I add gateway 192.168.22.1, the public IP is no longer accessible but the internal IP works.

I'm guessing I need to route all traffic from 192.168.22.x and 192.168.110.x through eth1 instead of eth0? How can I edit the interfaces file to fix this issue?

Kind regards, Tuinslak

share|improve this question

1 Answer 1

up vote 2 down vote accepted

After the eth1 block, add the line:

up route add -net 192.168.110.0 netmask 255.255.255.0 gw 192.168.22.1 dev eth1

This will set up a static route for the 192.168.110.0/24 network via 192.168.22.1.

As written, this route will get added the next time you start the interface. If you want to add the route while the interface is live, just execute (with root permissions) everything after the up.

share|improve this answer
    
That worked -- thanks ! –  Tuinslak Dec 13 '10 at 13:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.