Ubuntu 配置双网卡
需求:一个内网,用于访问客户设备相关,一个外网,路由器,可以上网,用于远程操作。
操作:
-
终端输入ifconfig,确认Ethernet硬件地址对应的device名称,如下,这里两个网卡分别是enp3s0与enp5s3,前者对应内网ip,自行设置的一个ip;后者对应无线路由器ip,动态获取的,注意这个也可静态指定。
2.修改IP设置,终端操作如下:
sudo vim /etc/network/interfaces
然后编辑以下代码:
# localhost 本地环回
auto lo
Iface lo inet loopback
#static ip 静态ip
auto enp3s0
Iface enp3s0 inet static
address 192.168.1.153
netmask 255.255.255.0
#gateway 192.168.1.1 #这个不要,切记
#dynamic ip路由器外网自动获取
auto enp5s3
iface enp5s3 inet dhcp