LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Bonding 2 NICS question (https://www.linuxquestions.org/questions/linux-networking-3/bonding-2-nics-question-4175667363/)

yangou 01-09-2020 06:13 AM

Bonding 2 NICS question
 
Hello

I would like to bond the 2 network interfaces on my Ubuntu server 18.04. There is information online about how to go about it, however I am confused about which IP information should I put in the bonding config file. The machine has two NICs. One is called eno1 and the second one enp13s0. Both interfaces are online and pinging.

Which IP address should I use for the bonding? Will it be a completely new IP? or can I use the IP of one of the live interfaces?

Thank you

dc.901 01-09-2020 07:10 AM

Quote:

Originally Posted by yangou (Post 6076257)
The machine has two NICs. One is called eno1 and the second one enp13s0. Both interfaces are online and pinging.

Which IP address should I use for the bonding? Will it be a completely new IP? or can I use the IP of one of the live interfaces?

Only the bonded NIC will have IP, see this for example:
https://www.interserver.net/tips/kb/...twork-bonding/

Perhaps, share your config files (feel free to mask the IPs), so we can understand and help?

yangou 01-13-2020 06:29 AM

Hello

Sorry for my late reply. I understand that only the bonded NIC will have an IP address. What I am not sure about is what IP should I use for the bonding NIC? My /etc/network/interfaces file looks like this:

Quote:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

#network card DHCPing
auto eno1
iface eno1 inet dhcp
ip a shows:

Quote:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp13s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether d0:50:99:d3:25:66 brd ff:ff:ff:ff:ff:ff
3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether d0:50:99:d3:25:67 brd ff:ff:ff:ff:ff:ff
inet 10.64.8.201/24 brd 10.64.8.255 scope global eno1
valid_lft forever preferred_lft forever
inet6 fe80::d250:99ff:fed3:2567/64 scope link
valid_lft forever preferred_lft forever


eno1 is DHCPing and working. enp13s0 is currently unpatched. I read online that on ubuntu 18.04 netplan is used to do NIC bonding by creating a file inside /etc/netplan/my_net.yaml. Which IP should I use in the config file (my_net.yaml)? Can I use the one from eno1?

Thank you

dc.901 01-13-2020 06:58 AM

Quote:

Originally Posted by yangou (Post 6077831)
Which IP should I use in the config file (my_net.yaml)? Can I use the one from eno1?

Certainly, you can use IP from eno1. Since there is DHCP, you may want to set DHCP server to reserve that IP, so no other client can get it.

jmgibson1981 01-13-2020 07:16 AM

I'm curious how it is getting eno1 if you are using 18.04. Systemd uses it's own naming scheme (read enp13s0). eno, eth, ens, and any others should no longer show up. Netplan is also used and /etc/network/interfaces should do nothing without the ifupdown package, which shouldn't be installed on 18.04. If this is an upgrade from 16.04 then you would still use /etc/network/interfaces at which point you shouldn't be using netplan unless you manually switch to it. 16.04 also used systemd so there is still no explanation for how eno is showing up there either. May want to sort that out first. Something is not right and until the base issue is fixed this will be a headache, if you get it working at all. Here is a netplan guide once you get sorted out.

*EDIT* Maybe I misunderstand how systemd does interface names. Your ip a command doesn't make any sense to me. I will readily admit I could be wrong on these points. *END EDIT*

https://netplan.io/examples

I would adjust their bond example to the below based on my own experience. I'm not sure how old that guide is but the formatting they have for a bond, which is similar to static ip's didn't work in my case. The below would probably work (based on what I eventually got working and other parts of the same guide). Single spaces, no tabs. Indentation is key in Yaml files.

*EDIT* Just did some looking around. Isn't in the guide but it appears some people have had to declare the interfaces individually with dhcp4/6: false in their netplan configs for bonds. I'm not sure if it's required or not as I cannot test it. They would be declared in the netplan config like so.

Code:

network:
 version: 2
 renderer: networkd
 ethernets:
  enp3s0:
  dhcp4: false
  dhcp6: false
  enp4s0:
  dhcp4: false
  dhcp6: false

*END EDIT*

Code:

network:
 version: 2
 renderer: networkd
 bonds:
  bond0:
  dhcp4: yes
  interfaces: [enp3s0, enp4s0]
  parameters:
    mode: active-backup
    primary: enp3s0

static ip. adjust as needed to your situation.

Code:

network:
 version: 2
 renderer: networkd
 bonds:
  bond0:
  dhcp4: false
  dhcp6: false
  addresses: [192.168.1.2/24]
  gateway4: 192.168.1.1
  nameservers:
    addresses: [8.8.8.8, 8.8.4.4]
  interfaces: [enp3s0, enp4s0]
  parameters:
    mode: active-backup
    primary: enp3s0

hell why not create a bridge for containers and virtual machines? no clue if this one works, but why not? if i had a dual nic server i'd try it just for the fun of it. any server i setup i automatically make a bridge. never know and it's easy enough to do.

Code:

network:
 version: 2
 renderer: networkd
 bonds:
  bond0:
  dhcp4: false
  dhcp6: false
  interfaces: [enp3s0, enp4s0]
  parameters:
    mode: active-backup
    primary: enp3s0
 bridges:
  br0:
  dhcp4: false
  dhcp6: false
  interfaces: [bond0]
  addresses: [192.168.1.2/24]
  gateway4: 192.168.1.1
  nameservers:
    addresses: [8.8.8.8, 8.8.4.4]


yangou 01-23-2020 04:26 AM

Thank you both for your time. You have helped me understand a few things. My NIC bonding is working now.

ALl the best.


All times are GMT -5. The time now is 02:11 AM.