0

I have a physical server that has two network cards. One of them is on the motherboard (card A) and the other is a new one that I added by myself (card B). this command:

lshw -class network

show that card A is active by default, no problem there. But card B is disabled, so I use:

sudo ifconfig  enp3s0 up

to enabling card B. (enp3s0 is Card B logical name).

After this, I just want to set a static IP for card b. and for this purpose I used these commands:

ifconfig enp3s0 "My Ip" netmask 255.255.0 up
route add default gw "My Ip"
echo "nameserver 8.8.8.8"> /etc/resolve.conf

then I ping google, and everything is fine. But, after a reboot Card B loose all the setting and become disabled again.

So I did some search and I did find out that I need to do some static Ip setting. I use

sudo nano /etc/network/interfaces 

to add static IP. and add this to interface file:

auto enp3s0
iface enp3s0 inet loopback
iface enp3s0
iface enp3s0 inet static
address "my ip"
netmask 255.255.255.0
gw "my ip"
dns-nameservers 8.8.4.4 8.8.8.8

After reboot, this setting is there, but Card B is disabled again.

for sums up, my question is, how to enable second network card permanently and how to set static Ip for it?

P.S: I have some network setting so I can't reset the network.

0

Ubuntu by default comes with netplan these days and it configures the network interfaces during the boot time.

When you restart your server, can you check file names in /run/systemd/network/ to see if they are generated by netplan?

If the files were generated by netplan, add your interface config in /etc/netplan/*.yml and apply the changes. Then see if the interface survives a reboot.

Here is a guide to set static IP using netplan.

|improve this answer|||||
  • in fact, I did this and add my interface in netplan.. – Milad Naderi Jul 4 '19 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.