You are not logged in.

#1 2018-02-28 20:21:42

deisi
Member
Registered: 2015-10-21
Posts: 37

Dont turn on a nic during boot

Hey I would like to NOT turn on a NIC during boot.

Reason: My pc has two network cards enp2s0 and eno1. enp2s0 is used for my normal network. I want this to be always working and to be the default for the host.

The second one gets assigned via virtio to a ubuntu VM and I want it to be used only by the VM. Not the host.
The problem is, that during boot, both Nic's get activated. And in particular the network behind eno1 (the one for the vm) has ipv6 and therefor automatically becomes the default for the host.

I use netctl for configuration of enp2s0, and the vm was configured via virt-manager and thus I belive uses dhcpd. Any suggestions how to deal with this?

PS: Its kind of hard to google for not turning on a nic during boot, because you only find the opposite.

Offline

#2 2018-02-28 20:29:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,952
Website

Re: Dont turn on a nic during boot

By "turning on" it sounds like you mean associating with a router/network and getting an ip address, right?

If that's what you want to avoid, then that is not automatic or on by default.  You must have enabled a service for this.  Just disable whichever networking service is establishing that connection.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-02-28 20:41:54

progandy
Member
Registered: 2012-05-17
Posts: 3,080

Re: Dont turn on a nic during boot

I believe IPv6 SLAAC is implemented in the kernel, so it will always run if you do not disable it with sysctl (sysctl.d)
Edit: Well, something still has to set the interface UP. What do you use to manage your network except netctl

systemctl list-unit-files | grep -Ei 'dhcp|dhcli|net|conn|wpa|wicd'

Is there a way to directly load a virtio driver for the nic? Then the host will never have the nic visible at all.
Edit: You can maybe bind either pci-stub or vfio-pci to the device if both nics have different pci ids.

Last edited by progandy (2018-02-28 20:56:49)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2018-02-28 21:07:29

deisi
Member
Registered: 2015-10-21
Posts: 37

Re: Dont turn on a nic during boot

I use netctl with the following profile:

[malte@serv netctl]$ cat bridge 
Description="Example Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(enp2s0)
IP=static
Address=('172.16.1.10/20')
Gateway=('172.16.1.1')
DNS=('172.16.1.1')
SkipForwardingDelay=yes

And I belive

[malte@serv netctl]$ sudo netctl list
[sudo] password for malte: 
* bridge
  ethernet-static

show that ethernet-static is disabled. NetworkManager is not installed, but dhcpd is and if I want to keep using virt-manager I belife it should be installed and enabled, or am I wrong her?

@Trilby
I mean something like

sudo ip link set eno1 down

currently I need to run this manually after every boot to make the device free for the VM

[malte@serv netctl]$ systemctl list-unit-files | grep -Ei 'dhcp|dhcli|net|conn|wpa|wicd'
sys-fs-fuse-connections.mount              static         
dhclient@.service                          disabled       
dhcpcd.service                             enabled        
dhcpcd@.service                            disabled       
netctl-auto@.service                       disabled       
netctl-ifplugd@.service                    disabled       
netctl-sleep.service                       disabled       
netctl-wait-online.service                 disabled       
netctl.service                             enabled        
netctl@.service                            static         
netctl@bridge.service                      enabled        
netctl@ethernet\x2dstatic.service          static         
systemd-networkd-wait-online.service       disabled       
systemd-networkd.service                   disabled       
telnet@.service                            static         
wpa_supplicant-nl80211@.service            disabled       
wpa_supplicant-wired@.service              disabled       
wpa_supplicant.service                     disabled       
wpa_supplicant@.service                    disabled       
systemd-networkd.socket                    disabled       
telnet.socket                              disabled       
network-online.target                      static         
network-pre.target                         static         
network.target                             static   

I tried to to the virtio passthrough, but then my VM stopped starting don't know why either.

Last edited by deisi (2018-02-28 21:14:40)

Offline

#5 2018-02-28 21:16:44

progandy
Member
Registered: 2012-05-17
Posts: 3,080

Re: Dont turn on a nic during boot

You have to disable dhcpcd.service on the host. I don't think you will need it there.

Last edited by progandy (2018-02-28 21:19:32)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2018-02-28 21:36:09

deisi
Member
Registered: 2015-10-21
Posts: 37

Re: Dont turn on a nic during boot

Thx I give it a try

Offline

Board footer

Powered by FluxBB