2

I have a server running Debian 8 Jessie that constantly loses it's internet access for seemingly no reason. The server has two wired connections, the internet access is on eth0 and the internal network is on eth1. The internal connection is working as normal.

The content of /etc/network/interfaces is:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
    address 132.248.25.125
    netmask 255.255.255.0
    network 132.248.25.0
    broadcast 132.248.25.255
    gateway 132.248.25.254
    dns-nameservers 132.248.204.1 132.248.10.2


allow-hotplug eth1
iface eth1 inet static
    address 192.169.1.249
    netmask 255.255.255.0
    network 192.169.1.0
    broadcast 192.169.1.255
    gateway 192.169.1.10

ifconfig:

eth0      Link encap:Ethernet  HWaddr 00:30:48:fe:a7:3c  
          inet addr:132.248.25.125  Bcast:132.248.25.255  Mask:255.255.255.0
          inet6 addr: fe80::230:48ff:fefe:a73c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4278205 errors:0 dropped:8744 overruns:0 frame:0
          TX packets:7134 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:371528685 (354.3 MiB)  TX bytes:832677 (813.1 KiB)
          Memory:f0000000-f001ffff

eth1      Link encap:Ethernet  HWaddr 00:30:48:fe:a7:3d  
          inet addr:192.169.1.249  Bcast:192.169.1.255  Mask:255.255.255.0
          inet6 addr: fe80::230:48ff:fefe:a73d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1206214 errors:0 dropped:2667 overruns:0 frame:0
          TX packets:3028234 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:75759114 (72.2 MiB)  TX bytes:4139225848 (3.8 GiB)
          Memory:f0060000-f007ffff

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:4644 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4644 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1006417 (982.8 KiB)  TX bytes:1006417 (982.8 KiB)

And for route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.169.1.10    0.0.0.0         UG    0      0        0 eth1
132.248.25.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.169.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

I'm very new to Linux so I'm not exactly sure what I'm looking for. My guess is that the default gateway is acting up, or the firewall is causing problems.

Any advice/help would be appreciated.

The results of ip a:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:30:48:fe:a7:3c brd ff:ff:ff:ff:ff:ff
    inet 132.248.25.125/24 brd 132.248.25.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::230:48ff:fefe:a73c/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:30:48:fe:a7:3d brd ff:ff:ff:ff:ff:ff
    inet6 fe80::230:48ff:fefe:a73d/64 scope link
       valid_lft forever preferred_lft forever

And for ip r:

132.248.25.0/24 dev eth0  proto kernel  scope link  src 132.248.25.125
0

Comment out one gateway. The one without Internet connection:

#gateway 192.169.1.10

Standard configuration can have only one and your route shows it is the internal gateway used right now.

If there are other networks behind this gateway add this:

post-up /sbin/ip route add 192.169.X.0/24 via 192.169.1.10
post-down /sbin/ip route del 192.169.X.0/24 via 192.169.1.10

for every network behind internal gateway.

  • By doing that, I won't lose access to my internal network? – TuturuJones Jan 30 '16 at 0:23
  • Yes, if internal network has also other IP ranges besides 192.169.1.*. Does it? What ranges? – Dariusz Bączkowski Jan 30 '16 at 0:26
  • It does, from 192.169.1.1 to 192.169.1.250. I did what you mentioned and I would only get a "Connect: Network is Unreachable" after doing /etc/networking restart. – TuturuJones Jan 30 '16 at 0:31
  • Gateway is not needed to access local network. After commenting out gateway show ip a and ip r command result. – Dariusz Bączkowski Jan 30 '16 at 0:34
  • I'll add it in a second, since the results are too long for comments. – TuturuJones Jan 30 '16 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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