dhcpcd-discuss

Re: setting virtual interface in container

Roy Marples

Tue Nov 10 08:46:58 2020

On 10/11/2020 02:04, msg board wrote:
I have a virtual interface vlan190 on my lxc container. When my container boots, this interface only get ipv6 address. The dhcpcd daemon is start by init environment using command dhcpcd . The expectation is that it will reach /etc/dhcpcd.conf file which is where I specify the interface to configure. Here is my dhcpcd.conf file (do read last few lines) . In Spite of this, I do not get IPv4 IP on my vlan190 .

When I run "dhcpcd --waitip 4 vlan190 on command line, I get IPv4 IP immediately. However I cannot specify vlan190 on my init scripts for dhcpcd. It has to go inside dhcpcd.conf. Is that a way to specify virtual interface in dhcpcd.conf.

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

interface vlan190
waitip 4

Your configuration looks fine and should work.
But this all depends how exactly your init script starts dhcpcd.
If you add this to /etc/dhcpcd.conf at the top

debug
logfile /var/log/dhcpcd.log

Then hopefully the logfile will give a clue as to why it's not working.

Roy

Follow-Ups:
Re: setting virtual interface in containermsg board
References:
setting virtual interface in containermsg board
Archive administrator: postmaster@marples.name