I have a strange problem with my routing table on my raspberry pi running arch linux.
greg@pi etc]$ uname -a
Linux pi 3.6.11-2-ARCH+ #1 PREEMPT Mon Dec 31 23:00:25 UTC 2012 armv6l GNU/Linux
I have the pi setup for a static IP address. Using netcfg and net-auto-wired services.
I am also using nmbd service as part of samba to allow me to ping the device by its hostname Strange thing is, the static ip I have assigned the device is not the ip that I am getting replies from when I communicate by the hostname.
Looking at the routing table seems to suggest the problem:
[greg@pi ~]$ ip route show
default via 192.168.1.1 dev eth0
default via 192.168.1.1 dev eth0 metric 204
192.168.0.0/24 via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.20 metric 204
[greg@pi ~]$
My interface settings:
[greg@pi ~]$ ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.3 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::ba27:ebff:fec9:1caf prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:c9:1c:af txqueuelen 1000 (Ethernet)
RX packets 1127 bytes 93818 (91.6 KiB)
RX errors 0 dropped 3 overruns 0 frame 0
TX packets 684 bytes 76203 (74.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ifb0: flags=130<BROADCAST,NOARP> mtu 1500
ether e2:bb:30:e7:d0:8a txqueuelen 32 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ifb1: flags=130<BROADCAST,NOARP> mtu 1500
ether 8a:e3:26:d4:38:b8 txqueuelen 32 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 20 bytes 1890 (1.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20 bytes 1890 (1.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
From another pc on the network I have verified that both IPs refers to the same interface (They have the same physical addresses).
Example of communications working:
[2013-01-22 00:37.47] ~
[GKuhn.GKUHN-L01] ? ping pi
Pinging pi [192.168.1.20] with 32 bytes of data:
Reply from 192.168.1.20: bytes=32 time=36ms TTL=64
Reply from 192.168.1.20: bytes=32 time=7ms TTL=64
Reply from 192.168.1.20: bytes=32 time=3ms TTL=64
Reply from 192.168.1.20: bytes=32 time=2ms TTL=64
Ping statistics for 192.168.1.20:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 36ms, Average = 12ms
[2013-01-22 00:37.54] ~
[GKuhn.GKUHN-L01] ? ping 192.168.1.3
Pinging 192.168.1.3 with 32 bytes of data:
Reply from 192.168.1.3: bytes=32 time=2ms TTL=64
Reply from 192.168.1.3: bytes=32 time=2ms TTL=64
Reply from 192.168.1.3: bytes=32 time=2ms TTL=64
Reply from 192.168.1.3: bytes=32 time=26ms TTL=64
Ping statistics for 192.168.1.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 26ms, Average = 8ms
Now as I said this setup is still working. But I am confused and would like to know a) How this is actually working b) How to fix it
P.S. Looking at my logs (below comes from "everything.log") I see some more references to dhcpcd
Jan 1 01:00:09 pi dhcpcd[108]: eth0: rebinding lease of 192.168.1.20
Jan 1 01:00:10 pi dhcpcd[108]: eth0: acknowledged 192.168.1.20 from 192.168.1.1
Jan 1 01:00:10 pi dhcpcd[108]: eth0: checking for 192.168.1.20
Jan 1 01:00:14 pi dhcpcd[108]: eth0: leased 192.168.1.20 for 3600 seconds
However I have no custom config for this process. Any suggestions on where I should be looking to debug this would be greatly appreciated.
Some more detail: The raspberry was connected to an edimax wifi usb dongle so I had set it up with this interface in mind as well. I had been using the arch Wireless Setup page as a guide.
I installed wireless_tools, dhcpcd (if it wasn't already I can't recall) and netcfg. I also installed net-auto-wired and net-auto-wireless in the hope that a connection would just work depending on which one was plugged in.
Below are the pertinent configuration files:
[greg@pi multi-user.target.wants]$ pwd
/etc/systemd/system/multi-user.target.wants
[greg@pi multi-user.target.wants]$ ls
cronie.service openntpd.service sshdgenkeys.service
dhcpcd@eth0.service remote-fs.target syslog-ng.service
net-auto-wired.service smbd.service
nmbd.service sshd.service
[greg@pi multi-user.target.wants]$
dhcpcd@eth0.service:
[greg@pi multi-user.target.wants]$ cat dhcpcd\@eth0.service
[Unit]
Description=dhcpcd on %I
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
[Service]
Type=forking
PIDFile=/run/dhcpcd-%I.pid
ExecStart=/usr/sbin/dhcpcd -q -w %I
ExecStop=/usr/sbin/dhcpcd -x %I
[Install]
Alias=multi-user.target.wants/dhcpcd@eth0.service
net-auto-wired.service:
[greg@pi multi-user.target.wants]$ cat net-auto-wired.service
[Unit]
Description=Provides automatic netcfg wired connection
[Service]
EnvironmentFile=/etc/conf.d/netcfg
ExecStart=/usr/bin/ifplugd -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action -fIns
ExecStop=/usr/bin/netcfg iface-down $WIRED_INTERFACE
[Install]
WantedBy=multi-user.target
[greg@pi multi-user.target.wants]$
[greg@pi network.d]$ pwd
/etc/network.d
[greg@pi network.d]$ ls
ethernet-static examples interfaces wlan0-xxx
[greg@pi network.d]$ cat wlan0-xxx
CONNECTION='wireless'
DESCRIPTION='Automatically generated profile by wifi-menu'
INTERFACE='wlan0'
SECURITY='wpa'
ESSID=xxx
IP='dhcp'
KEY=xxx
[greg@pi network.d]$ cat ethernet-static
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.1.3'
ROUTES=('192.168.0.0/24 via 192.168.1.1')
GATEWAY='192.168.1.1'
DNS=('192.168.1.1')
## For IPv6 autoconfiguration
#IP6=stateless
## For IPv6 static address configuration
#IP6='static'
#ADDR6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#ROUTES6=('abcd::1234')
#GATEWAY6='1234:0:123::abcd'
[greg@pi network.d]$
[greg@pi log]$ cat /etc/dhcpcd.conf
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Inform the DHCP server of our hostname for DDNS.
hostname
# To share the DHCP lease across OSX and Windows a ClientID is needed.
# Enabling this may get a different lease than the kernel DHCP client.
# Some upstream DHCP servers may also require a ClientID, such as FRITZ!Box.
#clientid
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname
noipv4ll
#static dns lookup address
#nohook resolv.conf
[greg@pi log]$
If there is anything I have omitted please let me know and I will post it.
A summary of services reported by systemctl:
[greg@pi ~]$ systemctl > services
[greg@pi ~]$ cat services
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys...t_misc.automount loaded active running Arbitrary Executable File Formats File System Automount Point
sys-devi...y-ttyAMA0.device loaded active plugged /sys/devices/dev:f1/tty/ttyAMA0
sys-devi...-net-eth0.device loaded active plugged ec00
sys-devi...mmcblk0p1.device loaded active plugged /sys/devices/platform/mmc_host/mmc0/mmc0:e624/block/mmcblk0/mmcblk0p1
sys-devi...mmcblk0p2.device loaded active plugged /sys/devices/platform/mmc_host/mmc0/mmc0:e624/block/mmcblk0/mmcblk0p2
sys-devi...k-mmcblk0.device loaded active plugged /sys/devices/platform/mmc_host/mmc0/mmc0:e624/block/mmcblk0
sys-devi...-net-ifb0.device loaded active plugged /sys/devices/virtual/net/ifb0
sys-devi...-net-ifb1.device loaded active plugged /sys/devices/virtual/net/ifb1
sys-devi...ttyprintk.device loaded active plugged /sys/devices/virtual/tty/ttyprintk
sys-module-configfs.device loaded active plugged /sys/module/configfs
sys-subs...ices-eth0.device loaded active plugged ec00
sys-subs...ices-ifb0.device loaded active plugged /sys/subsystem/net/devices/ifb0
sys-subs...ices-ifb1.device loaded active plugged /sys/subsystem/net/devices/ifb1
-.mount loaded active mounted /
boot.mount loaded active mounted /boot
dev-mqueue.mount loaded active mounted POSIX Message Queue File System
proc-sys...infmt_misc.mount loaded active mounted Arbitrary Executable File Formats File System
sys-kernel-config.mount loaded active mounted Configuration File System
sys-kernel-debug.mount loaded active mounted Debug File System
tmp.mount loaded active mounted Temporary Directory
systemd-...ord-console.path loaded active waiting Dispatch Password Requests to Console Directory Watch
systemd-...ssword-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
crond.service loaded failed failed LEGACY unit for "crond" rc script
cronie.service loaded active running Periodic Command Scheduler
dbus.service loaded active running D-Bus System Message Bus
dhcpcd@eth0.service loaded active running dhcpcd on eth0
getty@tty1.service loaded active running Getty on tty1
hwclock.service loaded active exited LEGACY unit for "hwclock" rc script
net-auto-wired.service loaded active running Provides automatic netcfg wired connection
network.service loaded active exited LEGACY unit for "network" rc script
nmbd.service loaded active running Samba NetBIOS name server
openntpd.service loaded active running OpenNTP Daemon
rc-local.service loaded active exited /etc/rc.local Compatibility
smbd.service loaded active running Samba SMB/CIFS server
sshd.service loaded active running OpenSSH Daemon
syslog-ng.service loaded active running System Logger Daemon
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems
systemd-sysctl.service loaded active exited Apply Kernel Variables
systemd-...es-setup.service loaded active exited Recreate Volatile Files and Directories
systemd-...-trigger.service loaded active exited udev Coldplug all Devices
systemd-udevd.service loaded active running udev Kernel Device Manager
systemd-...sessions.service loaded active exited Permit User Sessions
systemd-...le-setup.service loaded active exited Setup Virtual Console
dbus.socket loaded active running D-Bus System Message Bus Socket
syslog.socket loaded active running Syslog Socket
systemd-initctl.socket loaded active listening /dev/initctl Compatibility Named Pipe
systemd-journald.socket loaded active running Journal Socket
systemd-shutdownd.socket loaded active listening Delayed Shutdown Socket
systemd-...d-control.socket loaded active listening udev Control Socket
systemd-udevd-kernel.socket loaded active running udev Kernel Socket
arch-daemons.target loaded active active Arch Daemons
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User
network.target loaded active active Network
remote-fs.target loaded active active Remote File Systems
sockets.target loaded active active Sockets
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
syslog.target loaded active active Syslog
systemd-...iles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
67 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[greg@pi ~]$
Interestingly I tried disabling dhcpcd service as Martin suggested below in the comments and after confirming that it was disabled and rebooting, I saw no change, well pinging the raspberry showed a response from 192.168.1.3 which is different but ip route show
yielded the same result. I then tried disabling net-auto-wired
service. I rebooted the raspberry, and I then thought that I had lost access to the device (headless over ssh) as I hadn't re-enabled dhcpcd service. Interestingly I hadn't and my ip address is now 192.168.1.20.
dhcpcd service is not running at present:
[greg@pi log]$ systemctl | grep -i dhcp
[greg@pi log]$
This therefore tells me that there has to be some other dhcp mechanism that I am of yet unaware of.
Looking at systemctl and grepping for eth0:
[greg@pi log]$ systemctl -a --full | grep -i eth
sys-devices-platform-bcm2708_usb-usb1-1\x2d1-1\x2d1.1-1\x2d1.1:1.0-net-eth0.device loaded active plugged ec00
sys-subsystem-net-devices-eth0.device loaded active plugged ec00
LOAD = Reflects whether the unit definition was properly loaded.
[greg@pi log]$
I am not sure just yet what the above 2 services are but could they be related to the problem?