美文网首页
ubuntu 多网卡配置

ubuntu 多网卡配置

作者: 时彬斌 | 来源:发表于2020-01-02 18:27 被阅读0次

环境ubuntu16.04
通过ifconfig查看网卡的信息,也可以使用ls /proc/sys/net/ipv4/conf/

通过命令 vim /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# 千兆 自动获取
auto enth1
iface enth1 inet dhcp

#万兆 静态ip
auto enth0
iface enth0 inet static
address 192.168.1.2
netmask 255.255.255.0

发现修改了比如从192.168.1.2修改到了192.168.1.3以后,ip并没有生效,此时有两步可以操作:

  1. 重启机器,shutdown -r / reboot
  2. 使用一下命令
 ip addr flush dev enth0
ifdown enth0
# 有可能会报错,RTNETLINK answers: Cannot assign requested address,不用管它,执行以下即可。
ifup enth0 

测试网卡的带宽可以使用iperf3 进行测试:

  1. 在服务端:
 # 开启iperf3 服务
 iperf3 -s
  1. 测试端:
# 开启一个在同一网段的机器,在机器里执行以下命令,测试192.168.1.2所关联网卡的流量信息
 iperf3 -c 192.168.1.2

对某一网卡进行配置:
ifconfig eth0 192.168.1.3 netmask 255.255.255.0

相关文章

网友评论

      本文标题:ubuntu 多网卡配置

      本文链接:https://www.haomeiwen.com/subject/hwiooctx.html