LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-12-2013, 09:03 AM   #1
MartenH
Member
 
Registered: Jul 2005
Location: Lund, Sweden
Distribution: Debian
Posts: 78

Rep: Reputation: 23
Wrong default gateway set when attaching cable


Hello,

I am setting up a new server running debian and have run into a strange problem. Everything is correctly configured and works fine until I attach the cable for the internal network. As soon as I do that the default gateway is set to the IP of the internal NIC, and I loose all internet connectivity.

Here is my setup:
eth0 - internal facing - IP 192.168.200.1
eth1 - external facing - IP 89.253.82.xx

Both IPs are static, the server is acting as the DHCP server for the internal (192.168.200.0/24) network. I have disabled firewall (shorewall) to eliminate that part of the process for now.

I am using a combination of webmin and terminal to find/set all configurations.

I have the server set to act as a router.

route -n shows everything correctly with 89.253.82.xx as default gateway until I connect the cable to eth0. As soon as I do that route -n show the default gateway as 192.168.200.1.

I'll supply any and all logs and config files, just let me know which ones you need.

dhcpd.conf (through I doubt this is where the problem lies)
Code:
ddns-update-style none;
authoritative;
DHCPD_INTERFACE = "eth0";
subnet 192.168.200.0 netmask 255.255.255.0 {
	option routers 192.168.200.1;
	option subnet-mask 255.255.255.0;
	option broadcast-address 192.168.200.255;
	option domain-name "mydomain.com";
	option domain-name-servers 84.246.88.xx, 84.246.88.xx;

	range 192.168.200.100 192.168.200.149;
	default-lease-time 21600;
	max-lease-time 43200;


	# one fixed
	host speedster {
		hardware ethernet 6c:f0:49:05:43:FB;
		fixed-address 192.168.200.150;
		}
}
route -n with eth0 disconnected
Code:
root@holisrv2:/home/marten# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         89.253.82.xx   0.0.0.0         UG    0      0        0 eth1
89.253.82.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
route -n with eht0 connected
Code:
root@holisrv2:/home/marten# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.200.1   0.0.0.0         UG    0      0        0 eth0
89.253.82.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 eth1
192.168.200.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
As you can see the default gateway is immediately replaced.


etc/network/interfaces
Code:
auto lo eth1 eth0
iface lo inet loopback
        allow-hotplug eth1

# The primary network interface
iface eth1 inet static
        address 89.253.82.xx
        netmask 255.255.255.0
        broadcast 89.253.82.255
        network 89.253.82.0
        gateway 89.253.82.xx

#       gateway 89.253.82.xx
        # dns-* options are implemented by the resolvconf package, if installed


iface eth0 inet static
        address 192.168.200.1
        netmask 255.255.255.0
        broadcast 192.168.200.255
        network 192.168.200.0
Other output
Code:
root@holisrv2:/home/marten# cat /etc/networks
default         0.0.0.0
loopback        127.0.0.0
link-local      169.254.0.0
localnet        89.253.82.0
Code:
root@holisrv2:/home/marten# cat /etc/NetworkManager/NetworkManager.conf 
[main]
plugins=ifupdown,keyfile

[ifupdown]

managed=true
ifconfig eth0 disconnected
Code:
root@holisrv2:/home/marten# ifconfig
eth0      Link encap:Ethernet  HWaddr d4:3d:7e:4f:30:b8  
          inet6 addr: fe80::d63d:7eff:fe4f:30b8/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:39 errors:0 dropped:0 overruns:0 frame:0
          TX packets:115 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4146 (4.0 KiB)  TX bytes:13787 (13.4 KiB)
          Interrupt:43 Base address:0x8000 

eth1      Link encap:Ethernet  HWaddr 00:0e:0c:da:63:66  
          inet addr:89.253.82.137  Bcast:89.253.82.255  Mask:255.255.255.0
          inet6 addr: fe80::20e:cff:feda:6366/64 Scope:Link
          inet6 addr: 2a01:3b8:1265:aaaa:853a:3c70:1a2f:9432/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9969 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6053 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:7368748 (7.0 MiB)  TX bytes:1188294 (1.1 MiB)

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:3072 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3072 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:485052 (473.6 KiB)  TX bytes:485052 (473.6 KiB)
ifconfig eth0 connected
Code:
root@holisrv2:/home/marten# ifconfig
eth0      Link encap:Ethernet  HWaddr d4:3d:7e:4f:30:b8  
          inet addr:192.168.200.1  Bcast:192.168.200.255  Mask:255.255.255.0
          inet6 addr: fe80::d63d:7eff:fe4f:30b8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:39 errors:0 dropped:0 overruns:0 frame:0
          TX packets:148 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4146 (4.0 KiB)  TX bytes:18143 (17.7 KiB)
          Interrupt:43 Base address:0x8000 

eth1      Link encap:Ethernet  HWaddr 00:0e:0c:da:63:66  
          inet addr:89.253.82.137  Bcast:89.253.82.255  Mask:255.255.255.0
          inet6 addr: fe80::20e:cff:feda:6366/64 Scope:Link
          inet6 addr: 2a01:3b8:1265:aaaa:853a:3c70:1a2f:9432/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10033 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6071 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:7373108 (7.0 MiB)  TX bytes:1189634 (1.1 MiB)

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:3072 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3072 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:485052 (473.6 KiB)  TX bytes:485052 (473.6 KiB)
Thanks!

PS. Obfuscated domain name and end of IPs on purpose
 
Old 06-13-2013, 02:25 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
auto lo eth1 eth0 in etc/network/interfaces cause the issue.
Auto eth0 means "autoconfigure the eth0 interface" in Debian NetworkManager.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't set default gateway to different subnet redss Linux - Networking 7 02-09-2011 06:52 AM
Multiple NICs, different subnets, wrong default gateway being set qwbillings Linux - Networking 1 07-02-2009 09:23 AM
Default gateway not being set when using DHCP ret602 Linux - Networking 1 09-20-2007 12:17 PM
How to set default gateway Harlin Linux - Networking 2 02-28-2006 03:17 AM
How can I tell what my default gateway is currently set as? abefroman Linux - Networking 6 09-10-2005 12:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration