Debian – Incoming SSH works, but all outgoing fails

debianinternetnetworking

Terminology

I have a server (I'll refer to it as S1 ) running in the cloud, but it is misbehaving. I also have another server (S2) running in the same cloud network, connected to S1 through a separate network (eth1).

Server S1 is connected to that internal network through eth1, and directly connected to the web through eth0.

S1 is running Debian Jessie, upgraded from a clean Debian Wheezy by changing /etc/apt/sources.list.

S2, which works perfectly, is running Debian Wheezy. The same clean Debian Wheezy as S1 before the upgrade.

Situation

  • I can connect to S1 through SSH from outside the network
    • through interface eth0.
  • I can connect to S1 through SSH from another server (S2)
    • through interface eth1.
  • I can connect from S1 to the other server (S2)
    • through interface eth1.
  • I can not connect from S1 to the outside world
    • not through eth0
    • not through eth1
    • I cannot SSH to other servers; I cannot ping 8.8.8.8 (whilst S2 can); I cannot resolve hosts (using 8.8.8.8 in /etc/resolv.conf)

Problem and Attempts

I haven't got the strangest idea as to why I can't connect to the outside world.

iptables

$ iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

resolv.conf

$ cat /etc/resolv.conf
nameserver 10.147.234.1
nameserver 8.8.8.8
nameserver 8.8.4.4

interfaces

$ cat /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback

# The one directly connected to the web
auto eth0
iface eth0 inet dhcp

# The one connected to the internal network
auto eth1
iface eth1 inet dhcp

Ping requests

$ ping -I eth0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from (MY_IP) eth0: 56(84) bytes of data.
From (MY_IP) icmp_seq=1 Destination Host Unreachable
From (MY_IP) icmp_seq=2 Destination Host Unreachable
From (MY_IP) icmp_seq=3 Destination Host Unreachable

$ ping -I eth1 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from (INTERNAL_IP) eth0: 56(84) bytes of data.
From (INTERNAL_IP) icmp_seq=1 Destination Host Unreachable
From (INTERNAL_IP) icmp_seq=2 Destination Host Unreachable
From (INTERNAL_IP) icmp_seq=3 Destination Host Unreachable

route -n

$ route -n
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.147.234.0    0.0.0.0         255.255.255.0   U     0      0        0  eth1
(SUBNET_MY_IP (ends 0))    0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.169.254 85.222.226.153  255.255.255.255 UGH   0      0        0 eth0

ip_forward

$ cat /proc/sys/net/ipv4/ip_forward
0

ifconfig -a

$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr fa:16:3e:d9:ab:b0  
      inet addr:(MY_IP)  Bcast:(MY_IP_BUT_ENDS_WITH_255)  Mask:255.255.255.0
      inet6 addr: (MY_v6_IP) Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:75300 errors:0 dropped:0 overruns:0 frame:0
      TX packets:689 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:9905366 (9.4 MiB)  TX bytes:86792 (84.7 KiB)

eth1      Link encap:Ethernet  HWaddr fa:16:3e:2c:d7:80  
      inet addr:10.147.234.6  Bcast:10.147.234.255  Mask:255.255.255.0
      inet6 addr: (MY_INTERNAL_6_IP) Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:177 errors:0 dropped:0 overruns:0 frame:0
      TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:11626 (11.3 KiB)  TX bytes:1346 (1.3 KiB)

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:65536  Metric:1
      RX packets:135 errors:0 dropped:0 overruns:0 frame:0
      TX packets:135 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:22168 (21.6 KiB)  TX bytes:22168 (21.6 KiB)

Best Answer

According to ICMP request results you have problem with routing, show us: route -n, cat /proc/sys/net/ipv4/ip_forward and ifconfig -a.

After update: You don't have default route in route table, you can add it by: route add default gw x.x.x.x, you should compare your results with working machine and search for row containing: Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 x.x.x.x 0.0.0.0 UG 1024 0 0 eth0

As qasdfdsaq correctly pointed it's not persistent solution.