You are not logged in.

#1 2016-12-12 13:32:04

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Linux container doesn't send its hostname router

I have a linux container that doesn't send its hostname to my router and as such doesn't appear by hostname in the router's ARP table. It must be a configuration issue on my side.  I'm using netctl on the host to setup a bridge (br0) and am pointing the lxc to that bridge.  The network within the container works just fine, but again, only the IP I manually assigned to the lxc is detected by my router; the hostname of the lxc is not.  Thoughts are welcomed.

Here is the network section of my lxc config:

lxc.utsname = rhea
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags = up
lxc.network.ipv4 = 10.1.8.101/24
lxc.network.ipv4.gateway = 10.1.8.1
lxc.network.name = eth0

I have defined /etc/hostname within the lxc:

% hostname
rhea

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2016-12-12 14:17:04

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: Linux container doesn't send its hostname router

I generally have problems with netctl not announcing the hostname properly. It sometimes works, but I gave up on the issue since I started using Avahi.

Assimilate this information: https://wiki.archlinux.org/index.php/Ne … resolution

Offline

#3 2016-12-12 16:23:39

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Linux container doesn't send its hostname router

@Awebb - Thanks for the link.  Perhaps the best strategy is to move to a dhcp setup for the lxc rather than a static one.  Our wiki does not detail how to accomplish this and all the hits I am finding via googling seem specific to debian referencing files we do not ship.  Might be better for me to start a new thread at this point.

EDIT: https://bbs.archlinux.org/viewtopic.php?id=220621

Last edited by graysky (2016-12-12 16:31:13)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2016-12-14 08:49:20

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: Linux container doesn't send its hostname router

Awebb wrote:

I generally have problems with netctl not announcing the hostname properly. It sometimes works, but I gave up on the issue since I started using Avahi.

Assimilate this information: https://wiki.archlinux.org/index.php/Ne … resolution

Guys, netctl is just a set of scripts that call dhcpcd, dhclient, ip etc. So, it can't "announce" anything.

If a machine uses a static IP address and should be accesses by some name, and there is a DHCP server on the network (your router in a home LAN), that server MUST be configured. First, you need to tell it that dynamic IP range does not overlap with static IPs. Then, you need to put in place some sort of a map, a correspondence between IPs and names. The latter can be a /etc/hosts file or a more complicated nameserver config. For example, on our network, there is a table of MAC-to-IP addresses, so even if a machine that should have a static IP uses dhcpcd, it still gets assigned a proper static IP from the table.

So, if you use a static IP in a container, you also need to configure the nameserver that usually runs inside yout router. How you do it depends on the server and your goals. Even if you use a dhcp client to announce the container hostname to a nameserver, you still need to properly configure the static IP range at the DHCP.


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#5 2016-12-14 10:22:16

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: Linux container doesn't send its hostname router

Leonid.I, you are over-complicating things. To announce your hostname to the dhcp server, you need a method that is understood by that server. Since most commercial routers are made with Windows and Mac plug'n'play in mind, the most commonly understood methods are NetBIOS names and Zeroconf. Everything else is beyond the issue, here. There are no conflicts, no problems other than "the hostname is not being reported to the local DNS".

Offline

#6 2016-12-16 01:26:49

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: Linux container doesn't send its hostname router

Awebb wrote:

Leonid.I, you are over-complicating things. To announce your hostname to the dhcp server, you need a method that is understood by that server. Since most commercial routers are made with Windows and Mac plug'n'play in mind, the most commonly understood methods are NetBIOS names and Zeroconf. Everything else is beyond the issue, here. There are no conflicts, no problems other than "the hostname is not being reported to the local DNS".

And if the "router" is a dnsmasq + iptables? Or are you implying that adding static hosts to router /etc/hosts is more complicated than running avahi inside lxc? Also, I am yet to see a large network that uses avahi. None of the universities I've been to do that, so zeroconf is definitely not as popular as you believe.

BTW, I still don't understand what's the problem with netctl here. If you want zeroconf so much, there is an app for that (tm). But it would be disastrous to couple such functionality with netctl (or any other network manager software)...


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#7 2016-12-28 16:36:03

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: Linux container doesn't send its hostname router

Awebb wrote:

Leonid.I, you are over-complicating things. To announce your hostname to the dhcp server, you need a method that is understood by that server. Since most commercial routers are made with Windows and Mac plug'n'play in mind, the most commonly understood methods are NetBIOS names and Zeroconf. Everything else is beyond the issue, here. There are no conflicts, no problems other than "the hostname is not being reported to the local DNS".

You are overcomplicating. You just need to set relevant option in dhcp client settings (AFAIK dhcpcd default configuration reads local hostname).

Offline

Board footer

Powered by FluxBB