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

I have an ubuntu server with a public IP, which I can reach with ssh from my local machine. However, when i put this server in a private network, I can no longer reach it with ssh from my local machine. Also, this server no longer has internet connection. (pinging google returns "unknown host")

If I remove the server from the private network, I can ssh to it again.

Here is the output of ifconfig:

eth0  
Link encap:Ethernet  HWaddr aa:0c:fa:58:e9:89  
      inet addr:83.212.x.x  Bcast:83.212.x.x  Mask:255.255.254.0
      inet6 addr: y::y:y:y:y/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:472 errors:0 dropped:0 overruns:0 frame:0
      TX packets:232 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:39445 (39.4 KB)  TX bytes:16357 (16.3 KB)

eth1  
Link encap:Ethernet  HWaddr aa:00:0a:e5:59:7a  
      inet6 addr: y:y:y:y:y:y:y:y/64 Scope:Global
      inet6 addr: y:y:y:y:y:y:y:y/64 Scope:Global
      inet6 addr: y::y:y:y:y/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:745 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2463 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:70070 (70.0 KB)  TX bytes:255901 (255.9 KB)
eth2      
Link encap:Ethernet  HWaddr aa:35:7a:43:a4:77  
      inet addr:192.168.0.6  Bcast:192.168.0.255  Mask:255.255.255.0
      inet6 addr: y::y:y:y:y/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:1782 errors:0 dropped:0 overruns:0 frame:0
      TX packets:386 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:117153 (117.1 KB)  TX bytes:24309 (24.3 KB)

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:17715 errors:0 dropped:0 overruns:0 frame:0
      TX packets:17715 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:3986302 (3.9 MB)  TX bytes:3986302 (3.9 MB)

An here is the output of netstat -nr:

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0       0     eth2
0.0.0.0         83.212.x.x      0.0.0.0         UG        0 0       0     eth0
83.212.x.x      0.0.0.0         255.255.254.0   U         0 0       0     eth0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0       0     eth2

I have tried NATing, but it didn't work. Maybe I didn't do something correctly. I have no access to the router.

share|improve this question

closed as off-topic by Jenny D, mdpc, Ward, Falcon Momot, Journeyman Geek Jan 16 at 9:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – mdpc, Ward, Falcon Momot, Journeyman Geek
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 2 down vote accepted

Here's the culprit:

0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0       0     eth2
0.0.0.0         83.212.x.x      0.0.0.0         UG        0 0       0     eth0

You've got two default routes, you should only have one.

You can delete the route using route del default gw 192.168.0.1. I'm not certain of the syntax for ubuntu so you may want to double-check the man page first.

On a redhat-based system, you could remove it permanently by deleting the GATEWAY line in /etc/sysconfig/network-scripts/ifcfg-eth2 and doing ifcfg eth2 down; ifcfg eth2 up. I don't have a ubuntu server handy to find the matching commands there.

share|improve this answer
    
I am running Ubuntu 12.04 and there are no such files. I believe the equivalent is /etc/network/interfaces, which has no information about eth2. It just has the following lines: auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp Also, there is no command ifcfg –  vefthym Jan 15 at 10:55
    
I don't have any ubuntu server handy to check the syntax. But I'll update my answer with another way to temporarily fix it. –  Jenny D Jan 15 at 10:57
    
Thanks! It worked. Just for future reference, after doing this, you should also execute (in Ubuntu at least): sudo /etc/init.d/networking restart –  vefthym Jan 15 at 11:07

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