You are not logged in.

#1 2013-03-07 03:10:40

Kirtah
Member
Registered: 2013-03-07
Posts: 1

[SOLVED] netcfg static IP not persisting across reboots in VM

I ran into an issue with netcfg static IP not persisting across reboots in a VM. I figured it out, but it took me awhile as a brand new user, so I thought I'd post it.

Setup

Using VMWare Workstation 8.0.3 build-703057 with bridged networking
Host OS: Linux Mint 14 64-bit
Guest OS: Arch Linux 2013.03.01 x86_64

Given a fresh install on the guest, setup netcfg:

cd /etc/network.d
cp examples/ethernet-static ./myprofile

nano myprofile
#  customize this file. I also added NETMASK='255.255.255.0'

systemctl enable netcfg@myprofile
systemctl start netcfg@myprofile

Test the configuration. It should be successful:

ping google.com
Problem

See if the changes survive a reboot.

reboot
ping google.com

I got the error "connect: Network is unreachable".

Check the logs:

journalctl
G

I found the following netcfg failure..

netcfg@myprofile.service: main process exited, code=exited, status=1/FAILURE

..prior to the following device initialization:

kernel: e1000 0000:02:00.0 eth0: Intel(R) PRO/1000 Network Connection
system-udevd[117]: renamed network interface eth0 to emp2s0
Solution

It looks like netcfg is being started before the device it depends on has been initialized. Inform systemd of the
dependency so they start in the proper order:

# nano /etc/systemd/system/multi-user.target.wants/netcfg@myprofile.service
# Add the following to [Unit]. Remember to replace enp2s0 with your device name.
Requires=sys-subsystem-net-devices-enp2s0.device
After=sys-subsystem-net-devices-enp2s0.device

Test again:

reboot
ping google.com

This should now be successful.

Offline

Board footer

Powered by FluxBB