You are not logged in.

#1 2012-09-01 21:07:41

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

Static network with systemd works partially

Converted an Arch VM to pure systemd per the wiki.  My only issue is getting my static network config to work correctly.  I can ssh into the box from my host, but once inside the VM, it seems to not be able to resolve addresses.  For example:

{facade@arch_VM ~]$ ping www.archlinux.org
ping: unknown host www.archlinux.org

I configured a static network by creating two files, both of which per the systemd/services wiki page.

$ cat /etc/conf.d/network 
interface=eth0
address=192.168.0.116
netmask=24
broadcast=192.168.0.255
gateway=192.168.0.254
$ cat /etc/systemd/system/network.service 
[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down

[Install]
WantedBy=multi-user.target

Thoughts as to why I cannot resolve names are welcome.

Last edited by graysky (2012-09-01 21:11:18)


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

Offline

#2 2012-09-01 21:09:43

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: Static network with systemd works partially

you have to set "nameserver <ip>" in /etc/resolv.conf .

Offline

#3 2012-09-01 21:17:17

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

Re: Static network with systemd works partially

65kid wrote:

you have to set "nameserver <ip>" in /etc/resolv.conf .

I tried but no effect upon a reboot.

$ cat /etc/resolv.conf 
nameserver	192.168.0.1

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

Offline

#4 2012-09-01 21:23:59

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,645

Re: Static network with systemd works partially

Try

nameserver 8.8.8.8

or

nameserver 192.168.0.254

How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

#5 2012-09-01 21:28:57

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

Re: Static network with systemd works partially

@2Many - Neither has an effect after changing the file and rebooting.

EDIT: So if I convert the box back to a mixed systemd/sysv configuration, and boot using sysv as the init, everything works.  Seems like I'm missing something smile

The odd thing is that my workstation [the host PC] runs a mixed setup using the name network.service file and never had this problem.

Last edited by graysky (2012-09-01 21:35:42)


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

Offline

#6 2012-09-01 21:40:42

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,645

Re: Static network with systemd works partially

I ran a diff on your network.service file and mine and the only difference is that you don't have a newline at the end of the last line. Did systemd throw any errors when you added the service? Is it running when you check?

Run a diff on the file on your other machine to this one to see if it's also missing the newline.

Last edited by 2ManyDogs (2012-09-01 21:41:22)


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

#7 2012-09-01 21:43:51

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: Static network with systemd works partially

this has nothing to do with systemd, the nameserver is and always has been set in /etc/resolv.conf . I assume it doesn't work because of the way you configured the network in your VM settings (bridge/NAT?).

Offline

#8 2012-09-01 22:13:53

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

Re: Static network with systemd works partially

2ManyDogs wrote:

I ran a diff on your network.service file and mine and the only difference is that you don't have a newline at the end of the last line. Did systemd throw any errors when you added the service? Is it running when you check?

Run a diff on the file on your other machine to this one to see if it's also missing the newline.

No errors at all and both files are identical.  Thanks for the suggestion.

65kid wrote:

this has nothing to do with systemd, the nameserver is and always has been set in /etc/resolv.conf . I assume it doesn't work because of the way you configured the network in your VM settings (bridge/NAT?).

Ah, I didn't consider this as a variable... yes, the VM settings for networking is 'bridge' mode on the same NIC.  What I can't rationalize is why the VM is fine with sysv but not with systemd in this regard.


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

Offline

#9 2012-09-19 21:44:58

angel6700
Member
Registered: 2009-09-06
Posts: 23

Re: Static network with systemd works partially

Hello,
I think your problem can be that dpcpcd is still running at boot so it deletes your resolv.conf.
try:

# systemctl stop dhcpcd@eth0.service

# systemctl disable dhcpcd@eth0.service

or add your nameserver to /etc/resolv.conf.head

good luck

Last edited by angel6700 (2012-09-19 21:46:46)

Offline

#10 2012-09-27 21:06:10

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

Re: Static network with systemd works partially

OK ... This is really starting to piss me off.  Should I NOT be using bridge networking on my VM's config?  Is that my problem?

EDIT: Tried NAT as well but same results.

Last edited by graysky (2012-09-27 21:11:00)


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

Offline

#11 2012-09-27 21:10:45

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: Static network with systemd works partially

I believe running in bridged mode requires the vboxguest module on the guest, are you loading that?

Last edited by Scimmia (2012-09-27 21:11:01)

Offline

#12 2012-09-27 21:28:42

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: Static network with systemd works partially

Looked it up, it's not the vboxguest module, it's vboxnetadp and vboxnetflt. You didn't happen to be loading those in rc.conf, which got disabled when you switched to systemd?

Offline

#13 2012-09-27 22:07:21

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

Re: Static network with systemd works partially

Scimmia wrote:

Looked it up, it's not the vboxguest module, it's vboxnetadp and vboxnetflt. You didn't happen to be loading those in rc.conf, which got disabled when you switched to systemd?


Thanks for the suggestion.  They are all in /etc/modules-load.d/vbox.conf so it can't be that...


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

Offline

#14 2012-09-28 14:52:53

Kilzool
Member
From: Ireland
Registered: 2010-08-04
Posts: 232

Re: Static network with systemd works partially

If you haven't fixed this yet, re-check your 'gateway' -- usually that is your router.  192.168.1.1

Offline

#15 2012-09-30 01:50:32

Teaspoon
Member
Registered: 2012-08-29
Posts: 17

Re: Static network with systemd works partially

I'm going to assume that the IP address and routing and whatnot are working, so let's pay some attention to your nameserver. What sort of system is it? If it's the "bind" package on Arch, I think the default setup only accepts connections on the loopback interface so maybe that's part of your problem.

Make sure your bind install is up to date, too. Until a very recent update to the unit file in the bind package, systemd was starting named before the network interfaces came up, so it was failing to attach itself to interfaces other than the loopback.

Also, can you just confirm that your problems are ONLY with name resolution and that you can, in fact, ping an outside server by its IP? Google's nameserver at 8.8.8.8 is a pretty easy one to remember when you want something public to ping.

Offline

#16 2012-09-30 01:54:33

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

Re: Static network with systemd works partially

@kil - yes, the gateway is correctly assigned.
@tea - no, the network is totally down while running in pure systemd mode using the network.service recommended on the wiki.  The fucked-up thing is that my workstation (not a VM) works just fine with this setup.

Keeping a mixed system seems to work although it is a slap-dick solution.  /etc/rc.conf is read wherein I have defined the static networking.

Last edited by graysky (2012-09-30 01:56:39)


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

Offline

#17 2012-09-30 09:13:44

Teaspoon
Member
Registered: 2012-08-29
Posts: 17

Re: Static network with systemd works partially

Network is totally down? Yikes. What do "ip l l", "ip a l", and "ip r l show"? Did you remember to do a "systemctl enable network.service" to get that unit to start on boat? If you use "systemctl start network.service" to manually start the unit after boot does it start working?

Offline

#18 2012-09-30 10:07:12

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Static network with systemd works partially

This works for me without any rc.conf or network.d;

[Unit]
Description=Network Connectivity
Requires=sys-devices-pci0000:00-0000:00:04.0-0000:01:06.0-net-eth0.device
After=sys-devices-pci0000:00-0000:00:04.0-0000:01:06.0-net-eth0.device
Wants=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set eth0 up ; /sbin/ip addr add 192.168.1.251/24 dev eth0 ; /sbin/ip route add default via 192.168.1.250
ExecStop=/sbin/ip link set eth0 down

[Install]
WantedBy=multi-user.target

Just edit your values for sys-device and IP's. I think it is simple with just one file for static IP config and it is very stable. Of course, resolv.conf is needed too.

Offline

#19 2012-10-11 01:01:53

imatechguy
Arch Linux f@h Team Member
Registered: 2010-03-22
Posts: 66

Re: Static network with systemd works partially

I had this problem too, it has been very frustrating and was completely my own fault.  Check to see that you have iproute2 installed.  I did a "pacman -Rns initscripts" to get my pure systemd environment and without thinking let it also remove iproute2.  It took me days of google searches and testing before I read the network.service file and decided to see if /sbin/ip existed (it didn't).  Once I figured that out and which package supplied it re-installed iproute2, made a fix in my /etc/resolv.conf file and all seems well.

Offline

#20 2012-10-11 01:13:16

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: Static network with systemd works partially

imatechguy wrote:

I had this problem too, it has been very frustrating and was completely my own fault.  Check to see that you have iproute2 installed.  I did a "pacman -Rns initscripts" to get my pure systemd environment and without thinking let it also remove iproute2.  It took me days of google searches and testing before I read the network.service file and decided to see if /sbin/ip existed (it didn't).  Once I figured that out and which package supplied it re-installed iproute2, made a fix in my /etc/resolv.conf file and all seems well.

Not a similar problem at all since as you can see from his problem description he still had iproute2 (never uninstalled initscripts).


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#21 2012-10-11 01:19:09

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

Re: Static network with systemd works partially

ngoonee is correct... but thanks for trying smile

% pacman -Ss iproute
core/iproute2 3.5.1-1 [installed]
    IP Routing Utilities

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

Offline

#22 2012-12-11 20:40:25

theking2
Banned
From: Romanshorn Switzerland
Registered: 2009-03-04
Posts: 372

Re: Static network with systemd works partially

although this thread is rather old I suspect I have similar problems. Did you ever fix your static network setup / system conflict?


archlinux on a Gigabyte C1037UN-EU, 16GiB
a Promise  PDC40718 based ZFS set
root on a Samsung SSD PB22-J
running LogitechMediaServer(-git), Samba, MiniDLNA, TOR

Offline

#23 2012-12-11 21:23:57

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

Re: Static network with systemd works partially

I am happily using a netcfg@static.service now.

% cat /etc/network.d/static         
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.0.201'
GATEWAY='192.168.0.1'
DNS=('192.168.0.1')

PRE_DOWN='/usr/bin/pkill sshd'
POST_UP='/usr/sbin/ip link set eth0 mtu 4000'

Last edited by graysky (2012-12-11 21:24:13)


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

Offline

Board footer

Powered by FluxBB