Benny Siegert
2017-08-21 14:46:54 UTC
Hi!
I have a NetBSD VM with working networking in Google Compute Engine,
and a new one where it does not work.
GCE Networking has DHCP return a host address with a /32 netmask, plus
a gateway with a different address. The trick is that you also need a
host route to the gateway, directly over the interface.
The working setup is on this:
NetBSD 7.99.65 (DIAGNOSTIC) #0: Tue Mar 7 21:47:12 CET 2017
# /usr/pkg/sbin/dhcpcd --version
dhcpcd 6.11.5
Copyright (c) 2006-2016 Roy Marples
Compiled in features: INET IPv4LL INET6 DHCPv6 AUTH
# cat /etc/ifconfig.vioif0
!/usr/pkg/sbin/dhcpcd vioif0
!route add default `ifconfig vioif0 | awk '/inet / { print $2 }' | sed
's/[0-9]*$/1/'` -ifp vioif0
dhcpcd fails to set a default route, then it runs something like
# route add default 10.240.0.1 -ifp vioif0
# netstat -rnf inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Interface
default 10.240.0.1 UGS - - - vioif0
10.240.0.1/32 link#2 UC - - 1460 vioif0
10.240.0.3 127.0.0.1 UGHS - - 1460 lo0
10.240.0.3/32 link#2 UC - - - vioif0
127/8 127.0.0.1 UGRS - - 33624 lo0
127.0.0.1 lo0 UH - - 33624 lo0
# ifconfig vioif0
vioif0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: 42:01:0a:f0:00:03
inet 10.240.0.3 netmask 0xffffffff broadcast 10.240.0.3
inet6 fe80::1811:269b:ecb0:bcdf%vioif0 prefixlen 64 scopeid 0x2
The machine where this is not working is a recent -8:
NetBSD 8.0_BETA (GENERIC.201708192310Z)
# dhcpcd --version
dhcpcd 7.0.0-rc1
Copyright (c) 2006-2017 Roy Marples
Compiled in features: INET ARP IPv4LL INET6 DHCPv6 AUTH
From a non-configured network, I run dhcpcd:
# dhcpcd vioif0
DUID 00:01:00:01:21:2d:7a:15:52:54:00:12:34:56
vioif0: IAID 0a:f0:00:02
vioif0: rebinding lease of 10.240.0.2
vioif0: soliciting an IPv6 router
vioif0: leased 10.240.0.2 for 86400 seconds
vioif0: adding route to 10.240.0.2/32
vioif0: adding host route to 255.255.255.255
vioif0: adding default route via 10.240.0.1
forked to background, child pid 336
# netstat -rnf inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Interface
default 10.240.0.1 UGS - - 1460 vioif0
10.240.0.2 link#2 UHC - - 1460 vioif0
10.240.0.2/32 link#2 UC - - - vioif0
127.0.0.1 lo0 UHl - - 33624 lo0
255.255.255.255 link#2 UHCS - - 1460 vioif0
# ping 10.240.0.1
PING 10.240.0.1 (10.240.0.1): 56 data bytes
ping: sendto: Invalid argument
# ifconfig vioif0
vioif0: flags=0x8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: 42:01:0a:f0:00:02
inet 10.240.0.2/32 broadcast 10.240.0.2 flags 0x0
inet6 fe80::7a06:ce6a:2f4a:8e44%vioif0/64 flags 0x0 scopeid 0x2
This works:
# route delete default
delete net default
# route add -interface -host 10.240.0.1 10.240.0.2
add host 10.240.0.1: gateway 10.240.0.2
# route add default 10.240.0.1
add net default: gateway 10.240.0.1
How can I get dhcpcd to do the right thing?
--Benny.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
I have a NetBSD VM with working networking in Google Compute Engine,
and a new one where it does not work.
GCE Networking has DHCP return a host address with a /32 netmask, plus
a gateway with a different address. The trick is that you also need a
host route to the gateway, directly over the interface.
The working setup is on this:
NetBSD 7.99.65 (DIAGNOSTIC) #0: Tue Mar 7 21:47:12 CET 2017
# /usr/pkg/sbin/dhcpcd --version
dhcpcd 6.11.5
Copyright (c) 2006-2016 Roy Marples
Compiled in features: INET IPv4LL INET6 DHCPv6 AUTH
# cat /etc/ifconfig.vioif0
!/usr/pkg/sbin/dhcpcd vioif0
!route add default `ifconfig vioif0 | awk '/inet / { print $2 }' | sed
's/[0-9]*$/1/'` -ifp vioif0
dhcpcd fails to set a default route, then it runs something like
# route add default 10.240.0.1 -ifp vioif0
# netstat -rnf inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Interface
default 10.240.0.1 UGS - - - vioif0
10.240.0.1/32 link#2 UC - - 1460 vioif0
10.240.0.3 127.0.0.1 UGHS - - 1460 lo0
10.240.0.3/32 link#2 UC - - - vioif0
127/8 127.0.0.1 UGRS - - 33624 lo0
127.0.0.1 lo0 UH - - 33624 lo0
# ifconfig vioif0
vioif0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: 42:01:0a:f0:00:03
inet 10.240.0.3 netmask 0xffffffff broadcast 10.240.0.3
inet6 fe80::1811:269b:ecb0:bcdf%vioif0 prefixlen 64 scopeid 0x2
The machine where this is not working is a recent -8:
NetBSD 8.0_BETA (GENERIC.201708192310Z)
# dhcpcd --version
dhcpcd 7.0.0-rc1
Copyright (c) 2006-2017 Roy Marples
Compiled in features: INET ARP IPv4LL INET6 DHCPv6 AUTH
From a non-configured network, I run dhcpcd:
# dhcpcd vioif0
DUID 00:01:00:01:21:2d:7a:15:52:54:00:12:34:56
vioif0: IAID 0a:f0:00:02
vioif0: rebinding lease of 10.240.0.2
vioif0: soliciting an IPv6 router
vioif0: leased 10.240.0.2 for 86400 seconds
vioif0: adding route to 10.240.0.2/32
vioif0: adding host route to 255.255.255.255
vioif0: adding default route via 10.240.0.1
forked to background, child pid 336
# netstat -rnf inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Interface
default 10.240.0.1 UGS - - 1460 vioif0
10.240.0.2 link#2 UHC - - 1460 vioif0
10.240.0.2/32 link#2 UC - - - vioif0
127.0.0.1 lo0 UHl - - 33624 lo0
255.255.255.255 link#2 UHCS - - 1460 vioif0
# ping 10.240.0.1
PING 10.240.0.1 (10.240.0.1): 56 data bytes
ping: sendto: Invalid argument
# ifconfig vioif0
vioif0: flags=0x8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ec_capabilities=1<VLAN_MTU>
ec_enabled=0
address: 42:01:0a:f0:00:02
inet 10.240.0.2/32 broadcast 10.240.0.2 flags 0x0
inet6 fe80::7a06:ce6a:2f4a:8e44%vioif0/64 flags 0x0 scopeid 0x2
This works:
# route delete default
delete net default
# route add -interface -host 10.240.0.1 10.240.0.2
add host 10.240.0.1: gateway 10.240.0.2
# route add default 10.240.0.1
add net default: gateway 10.240.0.1
How can I get dhcpcd to do the right thing?
--Benny.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de