Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Can't autoconnect to wired net using NetworkManager
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
sirlark
Apprentice
Apprentice


Joined: 25 Oct 2004
Posts: 299
Location: Cape Town, South Africa

PostPosted: Fri Nov 02, 2012 8:45 pm    Post subject: [SOLVED] Can't autoconnect to wired net using NetworkManager Reply with quote

Hi all,

I run a desktop machine at home as a day-to-day work machine, media server etc. It is connected to my ADSL router by an ethernet cable, and both router and PC are always on. Previously, I used /etc/conf.d/net to configure and bring up my wired network device automatically during boot. But recently I installed NetworkManager mainly because it's the only thing I've ever to get my particular USB 3G modem working in Linux, and also becasue it's make turning the VPN to my office network on and off easy. Since I installed NetworkManager though, when the machine boots, it has an empty /etc/resolv.conf, with a single comment line saying the non-existent contents were set by dhcpcd. The NetworkManager try applet believes I'm connected, and indeed I can ping the router, but obviously DNS doesn't work. Only when I disconnect and reconnect does NetworkManager populate /etc/resolv.conf and then everything works. Also, I get some error messages during boot relating to /etc/conf.d/net, listed below; The eth0 connection is available to all users, and NetworkManager is in the default runlevel, so to my understanding eth1 should come up automatically should start automatically

The error messages on boot
Code:
/etc/init.d/../conf.d/net: line 7: default via 192.168.37.1: command not found
/etc/init.d/../conf.d/net: line 9: 192.168.37.2/24: No such file or directory


The file in question (/etc/conf.d/net)
Code:
#Generated by NetworkManager
###### Global Configuration ######

###### Connection Configuration ######
#----------------------------------
dns_servers_eth1="192.168.0.2 208.67.222.222 208.67.220.220"
routes_eth1= "default via 192.168.0.2"
auto_eth1="true"
config_eth1= "192.168.0.2/24"
enable_ipv6_eth1="false"
#----------------------------------
dns_domain="MASKED"
#----------------------------------
module_eth="!plug"


It seems the spaces are causing the issue, but NetworkManager is creating the file, not me... Also why is dhcpcd trying to run on eth1 when I start and wiping my /etc/resolv.conf?
_________________
Adopt an unanswered post today


Last edited by sirlark on Fri Nov 09, 2012 10:42 am; edited 1 time in total
Back to top
View user's profile Send private message
sirlark
Apprentice
Apprentice


Joined: 25 Oct 2004
Posts: 299
Location: Cape Town, South Africa

PostPosted: Sat Nov 03, 2012 5:04 am    Post subject: Reply with quote

I've fixed the issues in my /etc/conf.d/net (it was the spaces). I also then modified the connection and saved it in the NetworkManager tray applet, and it doesn't modify the file... I don't know where those comments came from originally? Maybe a cut 'n paste? Anyway, the point is that the error messages at boot have disappeared, but the problem about dhcpcd running and clobbering the resolv.conf is still there.
_________________
Adopt an unanswered post today
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2344

PostPosted: Sat Nov 03, 2012 12:15 pm    Post subject: Reply with quote

sirlark wrote:
the error messages at boot have disappeared, but the problem about dhcpcd running and clobbering the resolv.conf is still there.

sirlark ...

set dhcpcd not to request DNS, resolv.conf will then be untouched:

Code:
modules_eth0="dhcpcd"
dhcp_eth0="nodns"

best ... khay
Back to top
View user's profile Send private message
sirlark
Apprentice
Apprentice


Joined: 25 Oct 2004
Posts: 299
Location: Cape Town, South Africa

PostPosted: Sat Nov 03, 2012 3:49 pm    Post subject: Reply with quote

Thanks, just a quick question though... I notice you suggest disabling dchp on eth0, although eth0 isn't the issue. I've disabled dns on eth1, to no effect. Are you thinking that dhcp on eth0 is clobbering resolv.conf?
_________________
Adopt an unanswered post today
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2344

PostPosted: Sat Nov 03, 2012 4:52 pm    Post subject: Reply with quote

sirlark wrote:
Thanks, just a quick question though... I notice you suggest disabling dchp on eth0, although eth0 isn't the issue. I've disabled dns on eth1, to no effect. Are you thinking that dhcp on eth0 is clobbering resolv.conf?

sirlark ... well, the above is just an example, I wasn't disabling dhcp but setting it so than no DNS is requested from the dhcp server.

Whatever interface is using dhcp then without "nodns" the resolv.conf will be effected, so if you want dhcp on both interfaces, but no DNS, then:

Code:
modules="dhcpcd"
dhcp_eth0="nodns"
dhcp_eth1="nodns"

or similarly ... don't request NIS, NTP, DNS, don't send the hostname, and release the licence.

Code:
dhcp_eth0="release nontp nonis nosendhost nodns"

best ... khay
Back to top
View user's profile Send private message
sirlark
Apprentice
Apprentice


Joined: 25 Oct 2004
Posts: 299
Location: Cape Town, South Africa

PostPosted: Tue Nov 06, 2012 3:15 pm    Post subject: Reply with quote

Hi Khay,

I now have the following in /etc/conf.d/net, but still have the same problem.

Code:
dns_servers_eth1="192.168.0.2 208.67.222.222 208.67.220.220"
routes_eth1="default via 192.168.0.1"
auto_eth1="true"
config_eth1="192.168.0.2/24"
enable_ipv6_eth1="false"
dns_domain="MASKED"
module_eth="!plug"
dhcp_eth1="nodns nontp nonis"
dhcp_eth0="nodns nontp nonis"


Also, I note that one of my boot messages is
Code:
 * Starting DHCP Client Daemon ...                                        [ ok ]


So dhcp is still being initiated by the rc scripts somewhere, instead of from NetworkManager. Despite the prohibition of "nodns" my /etc/resolv.conf is still being clobbered.

Is there some current documentation for /etc/conf.d/net you could point me too?
_________________
Adopt an unanswered post today
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2344

PostPosted: Tue Nov 06, 2012 4:45 pm    Post subject: Reply with quote

sirlark wrote:
I now have the following in /etc/conf.d/net, but still have the same problem.

Code:
dns_servers_eth1="192.168.37.2 208.67.222.222 208.67.220.220"
routes_eth1="default via 192.168.37.1"
auto_eth1="true"
config_eth1="192.168.37.2/24"
enable_ipv6_eth1="false"
dns_domain="volundr.dyndns.org"
module_eth="!plug"
dhcp_eth1="nodns nontp nonis"
dhcp_eth0="nodns nontp nonis"

sirlark ... note that here eth1 is not configured via dhcp so the 'dhcp_eth1=' serves no purpose. Also, 'module_eth=' will likewise do nothing as 'eth' is not an interface. I'm not sure if this is a case of NetworkManager just not understanding the required constructs or if this is the result of subsequent manual edits, but the logic should follow the following: global, ie, 'modules=' (note 'modules' not 'module'), or per interface, ie, 'modules_${IFACE}, 'dhcp_${IFACE}, config_${IFACE}, etc.

I'm not sure what 'auto_eth1=true' is supposed to do, its not a construct I've seen documented ... but anyhow, probably the following is whats intended:

Code:
modules_eth1="!plug iproute2"
config_eth1="192.168.37.2/24"
routes_eth1="default via 192.168.37.1"
dns_servers_eth1="192.168.37.2 208.67.222.222 208.67.220.220"
dns_domain_eth1="volundr.dyndns.org"
enable_ipv6_eth1="false"

modules_eth0="!plug dhcpcd"
config_eth0="dhcp"
dhcp_eth0="nodns nontp nonis"
enable_ipv6_eth0="false"


sirlark wrote:
Also, I note that one of my boot messages is
Code:
 * Starting DHCP Client Daemon ... [ ok ]

So dhcp is still being initiated by the rc scripts somewhere, instead of from NetworkManager.

If its not in the runlevel (that is, your sure you haven't added it) then something depends on 'net' and so starts dhcpcd, which would mean that NetworkManager isn't providing 'net'. I've given up supporting NetworkManager so that is something you will have to work out for your self, however dhcpcd can be configured *not* to provide 'net' by adding the following to /etc/rc.conf

Code:
rc_dhcpcd_provide="!net"


sirlark wrote:
Despite the prohibition of "nodns" my /etc/resolv.conf is still being clobbered.

In your above configuration /etc/resolve.conf will be written (as you define domain and nameservers) ... also, as 'dns_domain=' is global it'll be run for both interfaces, so your best to either omit this entirely (that is make resolv.conf static) or simply define it (as I have above) for one interface.

sirlark wrote:
Is there some current documentation for /etc/conf.d/net you could point me too?

yes, /usr/share/doc/openrc-{version}/net.example.bz2

best ... khay
Back to top
View user's profile Send private message
sirlark
Apprentice
Apprentice


Joined: 25 Oct 2004
Posts: 299
Location: Cape Town, South Africa

PostPosted: Fri Nov 09, 2012 10:41 am    Post subject: Reply with quote

Right, so it seems no amount of editing /etc/conf.d/net would prevent dhcpcd from being started at boot. The reason being dnsmasq and apache both require "net", and NetworkManager weirdly enough doesn't provide it.

So I added these two lines to my /etc/rc.conf

Code:
rc_NetworkManager_provide="net"
rc_dhcpcd_provide="!net"


Leaving the 'rc_NetworkManager_provide="net"' line out just meant that apache, dnsmasq, etc just wouldn't start.
_________________
Adopt an unanswered post today
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum