# Net.eth0 dropping connection - stumped!

## T|TaN

Hello, 

I am experiencing the following problem, which I have been working on for two weeks now.

First let me explain my network setup. I have two network cards, eth0 is connected to cable modem A directly, whereas eth1 is connected to a switch services internal lan, which is connected to a firewall box (m0n0wall) and then out to the Internet on cable modem B. 

The symptom experienced is all network traffic will cease on eth0, irc pauses or disconnects entirely, ssh times out, apache stops serving pages, etc. Eth1, remains up without issue and has even taken over outbound traffic such as irc when eth0 dies.  

Here is what I have ruled out:

network card is fine, swapped it out with same issue.

network cable has been tested ok, and even swapped, same issue.

no isp dhcp or network issues (I work for the ISP I use.)

configured for both static configs on eth0 and dynamic configs, same issue.

tried multiple configurations in net file (ie. ifconfig, and iproute2)

purely random disconnects so nothing regular like a cron job or something interfering.

I have exhausted all my knowledge, and have scoured the forums as well without results.

So I am hoping that someone has some answers or even ideas, or just a fresh look at this.

Here is what my net config file looks like:

```

##########################################################################

####

# QUICK-START

#

# The quickest start is if you want to use DHCP.

# In that case, everything should work out of the box, no configuration

# necessary, though the startup script will warn you that you haven't

# specified anything.

#

# If you want to use a static address or use DHCP explicitly, jump

# down to the section labelled INTERFACE HANDLERS.

#

# If you want to do anything more fancy, you should take the time to

# read through the rest of this file.

##########################################################################

####

# MODULES

#

# We now support modular networking scripts which means we can easily

# add support for new interface types and modules while keeping

# compatability with existing ones.

#

# Modules load by default if the package they need is installed.  If

# you specify a module here that doesn't have it's package installed

# then you get an error stating which package you need to install.

# Ideally, you only use the modules setting when you have two or more

# packages installed that supply the same service.

#

# In other words, you probably should DO NOTHING HERE...

# Prefer iproute2 over ifconfig

modules=( "iproute2" )

modules=( "dhcpcd" )

# You can also specify other modules for an interface

# In this case we prefer udhcpc over dhcpcd

#modules_eth0=( "udhcpc" )

#modules_force=( "ifconfig" )

# You can also specify which modules not to use - for example you may be

# using a supplicant or linux-wlan-ng to control wireless configuration

#but

# you still want to configure network settings per ESSID associated

#with.

#modules=( "!iwconfig" )

##########################################################################

####

# INTERFACE HANDLERS

#config_eth0=( "192.168.0.2 netmask 255.255.255.0" )

#routes_eth0=( "default gw 192.168.0.1" )#

# We provide two interface handlers presently: ifconfig and iproute2.

# You need one of these to do any kind of network configuration.

# For ifconfig support, emerge sys-apps/net-tools

# For iproute2 support, emerge sys-apps/iproute2

# If you don't specify an interface then we prefer ifconfig it it's

#installed

# Prefer iproute2 over ifconfig

modules=( "iproute2" )

# For a static configuration, use something like this

# (They all do exactly the same thing btw)

#ifconfig_eth0=( "dhcp" )

#ifconfig_eth1=( "192.168.0.101/24 netmask 255.255.255.0 broadcast 192.168

.0.255" )

ifconfig_lo=( "127.0.0.1 netmask 255.255.255.0" )

routes_lo=( "default gw 127.0.0.1" )

#routes_lo=( "default gw 127.0.0.1" )

#config_eth0=( "192.168.0.2 netmask 255.255.255.0" )

#dhcp_eth0="nontp" #

# We can also specify a broadcast

#ifconfig_eth1=( "192.168.0.101/24 broadcast 192.168.0.255" )

#config_eth0=( "192.168.0.2 netmask 255.255.255.0 broadcast

#192.168.0.255" )

#new dec. 2

#config_eth0=( "dhcp" )

#dhcpcd_eth0="-t 10" # Timeout after 10 seconds

#dhcp_eth0="release nodns nontp nonis" # Only get an address

#end

ifconfig_eth0=( "dhcp" )

dhcp_eth0=( "nontp" )

#ifconfig_eth0=( "68.145.9.93 netmask 255.255.255.0" )

#routes_eth0=( "default gw 68.145.9.1" )

ifconfig_eth1=( "192.168.0.101 netmask 255.255.255.0" )

routes_eth1=( "default gw 192.168.0.1" )

# If you need more than one address, you can use something like this

# NOTE: ifconfig creates an aliased device for each extra IPv4 address

#       (eth0:1, eth0:2, etc)

#       iproute2 does not do this

#config_eth0=(

#       "192.168.0.2/24"

#       "192.168.0.3/24"

#       "192.168.0.4/24"

#)

# You can also use IPv6 addresses

#config_eth0=(

#       "192.168.0.2/24"

#       "4321:0:1:2:3:4:567:89ab"

#       "4321:0:1:2:3:4:567:89ac"

#)

# If you wish to keep existing addresses + routing and the interface is

#up,

# you can specify a noop (no operation). If the interface is down or

#there

# are no addresses assigned, then we move onto the next step (default

#dhcp)

# This is useful when configuring your interface with a kernel command

#line

# or similar

#config_eth0=( "noop" "192.168.0.2/24" )

# If you don't want ANY address (only useful when calling for advanced

#stuff)

#config_eth0=( "null" )

# Here's how todo routing if you need it - the below sets the default

#gateway

#routes_eth0=(

#       "default via 192.168.0.1"

#       "default via 4321:0:1:2:3:4:567:89ab"

#)

# If a specified module fails (like dhcp - see below), you can specify a

# fallback like so

#fallback_eth0=( "192.168.0.2 netmask 255.255.255.0" )

#fallback_route_eth0=( "default via 192.168.0.1" )

# NOTE: fallback entry must match the entry location in config_eth0

# As such you can only have one fallback route.

##########################################################################

####

# OPTIONAL MODULES

#-------------------------------------------------------------------------

----

# WIRELESS (802.11 support)

# Wireless can be provided by iwconfig or wpa_supplicant

# iwconfig

# emerge net-wireless/wireless-tools

# Wireless options are held in /etc/conf.d/wireless - but could be here

#too

# Consult the sample file /etc/conf.d/wireless.example for instructions

# iwconfig is the default

# wpa_supplicant

# emerge net-wireless/wpa-supplicant

# Wireless options are held in /etc/wpa_supplicant.conf

# Consult the sample file /etc/wpa_supplicant.conf.example for

#instructions

# To choose wpa_supplicant over iwconfig

#modules=( "wpa_supplicant" )

# To configure wpa_supplicant

#wpa_supplicant_eth0="-Dprism54" # For Prism54 based cards

#wpa_supplicant_ath0="-Dmadwifi" # For Atheros based cards

# Consult wpa_supplicant for more drivers

# By default we give wpa_suppliant 60 seconds to associate and

#authenticate

#wpa_timeout_eth0=60

# GENERIC WIRELESS OPTIONS

# PLEASE READ THE INSTRUCTIONS IN /etc/conf.d/wireless.example FOR

# HOW TO USE THIS ESSID VARIABLE

# You can also override any settings found here per ESSID - which is

#very

# handy if you use different networks a lot

#config_ESSID=( "dhcp" )

#dhcpcd_ESSID="-t 5"

# Setting name/domain server causes /etc/resolv.conf to be overwritten

# Note that if DHCP is used, and you want this to take precedence then

# set dhcp_ESSID="nodns"

#dns_servers_ESSID=( "192.168.0.1" "192.168.0.2" )

#dns_domain_ESSID="some.domain"

#dns_search_domains_ESSID="search.this.domain search.that.domain"

# Please check the man page for resolv.conf for more information

# as domain and search (searchdomains) are mutually exclusive and

# searchdomains takes precedence

# You can also override any settings found here per MAC address of the

#AP

# incase you use Access Points with the same ESSID but need different

# networking configs. Below is an example - of course you use the same

# method with other variables

#mac_config_001122334455=( "dhcp" )

#mac_dhcpcd_001122334455="-t 10"

#mac_dns_servers_001122334455=( "192.168.0.1" "192.168.0.2" )

# When an interface has been associated with an Access Point, a global

# variable called ESSID is set to the Access Point's ESSID for use in

#the

# pre/post user functions below (although it's not available in preup as

#you

# won't have associated then)

# If you're using anything else to configure wireless on your interface

#AND

# you have installed any of the above packages, you need to disable them

#modules=( "!iwconfig" "!wpa_supplicant" )

```

recent dmesg entries:

```

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

eth0: link down

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

vs-8301: reiserfs_kmalloc: allocated memory 201292

vs-8301: reiserfs_kmalloc: allocated memory 402780

eth0: link down

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

```

Also /var/log/messages has nothing about the nic.

Thanks for your time.

----------

## desultory

This might strike you as a silly question, but I have to ask: why do you have two cable modems, both connected to the Internet?

Have you tried role reversal on the nics? By this I mean eth1 connected to cable modem A, eth0 to the switch which connects it to the firewall which is connected to cable modem B; I do not mean physically swapping the cards I mean logically swapping what eth0 and eth1 do.

----------

## T|TaN

 *desultory wrote:*   

> This might strike you as a silly question, but I have to ask: why do you have two cable modems, both connected to the Internet?
> 
> Have you tried role reversal on the nics? By this I mean eth1 connected to cable modem A, eth0 to the switch which connects it to the firewall which is connected to cable modem B; I do not mean physically swapping the cards I mean logically swapping what eth0 and eth1 do.

 

Hey Desultory, 

Yes, I should have mentioned that, but yes, I have done this, with no change.

Oh and to answer your question on the cable modems, I would like to do load balancing or have a backup route to the linux box.  Eth0 gets quite alot of traffic and sometimes it becomes difficult to ssh in with any kind of speed.  Also, the eth1 makes the gentoo server accessible to the local network for file sharing and such.

----------

## desultory

 *T|TaN wrote:*   

>  *desultory wrote:*   Have you tried role reversal on the nics? By this I mean eth1 connected to cable modem A, eth0 to the switch which connects it to the firewall which is connected to cable modem B; I do not mean physically swapping the cards I mean logically swapping what eth0 and eth1 do. 
> 
> Yes, I should have mentioned that, but yes, I have done this, with no change.

 

So whether the interface connected to cable modem A is logically eth0 or eth1 has no effect on the connection dropping?

Have you checked loading?

Have you found any indication of what is happening when the connection drops, could it be DHCP lease expiry?

The reason I ask is, if I correctly parse this:

 *T|TaN wrote:*   

> 
> 
> ```
> 
> ---SNIP---
> ...

 

You set it to load iproute2 then reset it to load dhcp then reset it to load iproute2, leaving you without dhcp.

Am I right in thinking that those should all be commented out to be replaced with this:

```
modules=( "dhcpcd" "iproute2" )
```

or this

```

modules=( "iproute2" )

modules_eth0=( "dhcpd" )

```

?

Or does this:

 *T|TaN wrote:*   

> 
> 
> ```
> 
> ifconfig_eth0=( "dhcp" )
> ...

 

not one shot setup but actually launch the daemon?

I ask because whereas you have already ruled out server side DHCP problems, the problem here would be client side DHCP.

Just a thought.

 *T|TaN wrote:*   

> Oh and to answer your question on the cable modems, I would like to do load balancing or have a backup route to the linux box.  Eth0 gets quite alot of traffic and sometimes it becomes difficult to ssh in with any kind of speed.  Also, the eth1 makes the gentoo server accessible to the local network for file sharing and such.

 

I see, you can do admin through the back door no matter how busy the front door gets, handy that.  I understood about having a LAN, it was just the whole {Internet} <--> DMZ system <--> firewall <--> LAN <--> firewall <--> {Internet} setup piqued my interest.

----------

## T|TaN

Today it has been really good.  So for now I am going to see how it goes and monitor the connection through ping plots and have a friend graph on rrd tool.  These are excellent suggestions and I will implement them when the connection goes down, if it does.

Thanks!

----------

## T|TaN

 *T|TaN wrote:*   

> Today it has been really good.  So for now I am going to see how it goes and monitor the connection through ping plots and have a friend graph on rrd tool.  These are excellent suggestions and I will implement them when the connection goes down, if it does.
> 
> Thanks!

 

wow i just got to eat my words, just dropped connection. more entries from dmesg:

eth0: link down

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

Ok, I am going to implement some of your suggestions  :Wink: 

----------

## T|TaN

Ok, I need someone to post a working net file for two nics.

Now I am faced with only being able to pass traffic over eth1.  When I start net.eth0 I can see that is leases an ip address.  But i cannot ping or pass traffic on eth0.

Thanks.

----------

## T|TaN

well I have made some changes and slimmed down the net file, anyone mind poking any holes in this?  and I am still seeing a disconnect from time to time, although not as bad:

```

config_eth0=( "dhcp" )

#config_eth0=( "68.145.9.93 netmask 255.255.255.0 broadcast

#68.145.0.255" )

#routes_eth0=( "68.145.9.1" )

preup() {

   echo "setting interface to $config_eth0"

    return 0

}

postup() {

    ifconfig eth0

    return 0

}

config_eth1=( "192.168.0.101 netmask 255.255.255.0 broadcast 192.168.0.255" )

routes_eth1=( "default via 192.168.0.1" )

preup() {

   echo "setting interface to $config_eth1"

    return 0

}

postup() {

    ifconfig eth1

    return 0

}

config_lo=( "127.0.0.1 netmask 255.255.255.0" )

routes_eth1=( "default via 127.0.0.1" )

```

Thanks...

----------

## egberts

How about a WireShark analysis on your NIC card facing the cable modem?

That should tell you the better picture.

----------

