# Network configured - can't communicate with gateway



## circa (May 25, 2013)

Hello all. I'm having a networking problem with my 8.3-RELEASE installation and I've exhausted my knowledge on what to do. In a nutshell:

When the system boots the ethernet adapter is brought up and is configured via DHCP
The routing table is set up with a default route to the gateway during the boot process
After booting, no net communication seems to be able to reach the gateway
One unusual thing I've noticed is that the adapter only gets configured during boot if it's set to SYNCDHCP in rc.conf. Regular DHCP never gets it configured, and manually setting an IP address/netmask and the defaultrouter also seem to fail.

Pinging the gateway gets me:

```
ping: sendto: Host is down
```

A variety of other networking apps also throw connection errors, even when trying to connect via IP address.

So given that the interface can be configured via DHCP it seems like the adapter should be able to talk to the gateway, and it doesn't seem like just a DNS issue because all IP fails. Any thoughts?

rc.conf:

```
# -- sysinstall generated deltas -- # Sat Jan 23 13:28:04 2010
# Created: Sat Jan 23 13:28:04 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
#network_interfaces="lo0 ep0"
rc_debug="YES"
#defaultroute_delay="60"
#ip6addrctl_enable="NO"
#ip6addrctl_policy="ipv4_prefer"
#ipv6_network_interfaces="none"
#ipv6_activate_all_interfaces="NO"
ifconfig_ep0="SYNCDHCP"
inetd_enable="YES"
#sshd_enable="YES"
hostname="vernon"
#ntpdate_enable="YES"
#ntpd_enable="YES"
#defaultrouter="192.168.1.1"
```

`ifconfig`:

```
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000 
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
ep0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:50:04:cc:d1:5c
	inet 192.168.1.4 netmask 0xffffff00 broadcast 192.168.1.255
	media: Ethernet 10baseT/UTP
	status: active
```

`netstat -r`:

```
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            192.168.1.1        UGS         0        0    ep0
localhost          link#2             UH          0        0    lo0
192.168.1.0        link#3             U           0       26    ep0
192.168.1.4        link#3             UHS         0        0    lo0

Internet6:
Destination        Gateway            Flags      Netif Expire
::                 localhost          UGRS        lo0
localhost          localhost          UH          lo0
::ffff:0.0.0.0     localhost          UGRS        lo0
fe80::%lo0         link#2             U           lo0
fe80::1%lo0        link#2             UHS         lo0
ff01::%lo0         fe80::1%lo0        U           lo0
ff02::%lo0         fe80::1%lo0        U           lo0
```

`route show default`:

```
route to: default
destination: default
       mask: default
    gateway: 192.168.1.1
  interface: ep0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0
```

`rcorder /etc/rc.d/*`: http://pastebin.com/6qA7ReXB

`dmesg` with rc_debug="YES": http://pastebin.com/gBrC75Y4

And some relevant dmesg snippets:

```
...
ep0: <3Com Megahertz 589E> at port 0x100-0x10f irq 11 function 0 config 1 on pccard0
ep0: Ethernet address: 00:50:04:cc:d1:5c
ep0: [ITHREAD]
...
/etc/rc: DEBUG: run_rc_command: doit: network_start 
/etc/rc: DEBUG: Cloned: 
/etc/rc.d/dhclient: DEBUG: pid file (/var/run/dhclient.ep0.pid): not readable.
/etc/rc.d/dhclient: DEBUG: run_rc_command: start_precmd: dhclient_prestart 
/etc/rc.d/dhclient: DEBUG: checkyesno: background_dhclient is set to NO.
Starting dhclient.
/etc/rc.d/dhclient: DEBUG: run_rc_command: doit: /sbin/dhclient  ep0 
DHCPREQUEST on ep0 to 255.255.255.255 port 67

DHCPACK from 192.168.1.1

bound to 192.168.1.4 -- renewal in 43200 seconds.

Starting Network: lo0 ep0.
/etc/rc: DEBUG: checkyesno: rc_startmsgs is set to YES.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000 
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
ep0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:50:04:cc:d1:5c
	inet 192.168.1.4 netmask 0xffffff00 broadcast 192.168.1.255
	media: Ethernet 10baseT/UTP
	status: active
/etc/rc: DEBUG: The following interfaces were not configured: 
...
/etc/rc: DEBUG: run_rc_command: doit: routing_start 
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
...
```


----------



## wblock@ (May 25, 2013)

It's been a long time since I've tried a PC Card, but last I looked devd(8) was set to handle them.  That may be interacting with your rc.conf config.  See devd.conf(5) and the actual /etc/devd.conf.  Maybe comment the entries in /etc/rc.conf and see if dhclient(8) is still started automatically.


----------



## circa (May 25, 2013)

Thanks, your suggestion to comment out the ifconfig lines from rc.conf and to check into devd has gotten me closer. I don't seem to be out of the woods yet, though.

If I comment out all ifconfig lines in rc.conf, then the system boots without configuring ep0 as normal. After logging in I can run `dhclient ep0`, which gets ep0 bound to an IP address properly and then network communications work fine.

However, I noticed that the link light for the interface was coming on before devd was being started. As I looked through /etc/devd.conf, I noticed that dhclient is only invoked when the LINK_UP message is received - which I thought could explain why the interface never gets configured when 
	
	



```
ifconfig_ep0="DHCP"
```
 is set in rc.conf.

So I added some overrides in devd.conf:

```
# Add higher-priority ATTACH action for ep0
notify 1 {
	match "system"		"IFNET";
	match "subsystem"	"ep0";
	match "type"		"ATTACH";
	action "/etc/pccard_ether $subsystem start";
	action "/etc/rc.d/dhclient start $subsystem";
};

notify 0 {
	match "system"		"IFNET";
	match "type"		"ATTACH";
	action "/etc/pccard_ether $subsystem start";
};


# Add higher-priority LINK_UP action for ep0
notify 1 {
	match "system"		"IFNET";
	match "subsystem"	"ep0";
	match "type"		"LINK_UP";
	action "logger not performing ep0 LINK_UP action";
};

notify 0 {
	match "system"		"IFNET";
	match "type"		"LINK_UP";
	media-type		"ethernet";
	action "/etc/rc.d/dhclient start $subsystem";
};
```

The ATTACH action for ep0 will run both pccard_ether and dhclient for ep0, while the LINK_UP action does nothing, just to override the default action of running dhclient.

With these additions to devd.conf in place, when 
	
	



```
ifconfig_ep0="DHCP"
```
 is commented out of rc.conf, `dhclient` generates an error during boot:

```
'ep0' is not a DHCP-enabled interface
```

When 
	
	



```
ifconfig_ep0="DHCP"
```
 is active in rc.conf, after devd starts ep0 gets configured via DHCP successfully - but - the original problem of not being able to talk to the gateway returns.

I am presuming that `/etc/rc.d/dhclient` gets its list of DHCP-configurable interfaces from rc.conf, as I haven't seen anything to the contrary. Otherwise, it seems that the drivers and card work fine - it's just the timing of running `dhclient` that is (at least symptomatic of) the problem.


----------

