1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > ubuntu 网卡双网口 配置_Ubuntu双线双网卡双IP配置方法

ubuntu 网卡双网口 配置_Ubuntu双线双网卡双IP配置方法

时间:2023-05-28 01:29:46

相关推荐

ubuntu 网卡双网口 配置_Ubuntu双线双网卡双IP配置方法

### 服务器7环境

操作系统:ubuntu-16.04-server

接入IP如下:

IP1: 192.168.107.4; 子网掩码: 255.255.255.0; 网关:

IP4: 192.168.108.4; 子网掩码: 255.255.255.0; 网关:192.168.108.254

### 操作步骤

#### 网卡信息

~~~

cgz@ubuntu:~$ ifconfig

eno1 Link encap:Ethernet HWaddr 04:27:58:0c:f6:1f

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Interrupt:26

eno2 Link encap:Ethernet HWaddr 04:27:58:0c:f6:20

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Interrupt:95

eno3 Link encap:Ethernet HWaddr 04:27:58:0c:f6:21

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Interrupt:26

eno4 Link encap:Ethernet HWaddr 04:27:58:0c:f6:22

inet addr:192.168.108.4 Bcast:192.168.108.255 Mask:255.255.255.0

inet6 addr: fe80::627:58ff:fe0c:f622/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:4244 errors:0 dropped:8 overruns:0 frame:0

TX packets:106129921 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:238491 (2.3 GB) TX bytes:159399814718 (159.3 GB)

Interrupt:95

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:65536 Metric:1

RX packets:230 errors:0 dropped:0 overruns:0 frame:0

TX packets:230 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1

RX bytes:15858 (15.8 KB) TX bytes:15858 (15.8 KB)

~~~

##### 配置网卡信息

配置网卡1和网卡4

运行命令

~~~

$ gedit /etc/network/interfaces

~~~

把里面的配置修改为如下:

~~~

source /etc/network/interfaces.d/*

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eno1

iface eno1 inet static

address 192.168.107.4

netmask 255.255.255.0

network 192.168.107.0

broadcast 192.168.107.255

# gateway 192.168.107.254

# dns-* options are implemented by the resolvconf package, if installed

dns-nameservers 10.10.50.1

# The primary network interface

auto eno4

iface eno4 inet static

address 192.168.108.4

netmask 255.255.255.0

network 192.168.108.0

broadcast 192.168.108.255

gateway 192.168.108.254

# dns-* options are implemented by the resolvconf package, if installed

dns-nameservers 10.10.50.1

~~~

保存配置信息并且得启网卡

~~~

$ /etc/init.d/networking restart

~~~

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。