0
点赞
收藏
分享

微信扫一扫

Ubuntu18.04 server 双网卡,一个设置为静态IP, 一个设置为动态IP

操作目的如题:


修改网络配置文件:

sudo vim /etc/netplan/50-cloud-init.yaml



修改内容如下:

# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp7s0:
dhcp4: true
nameservers:
addresses:
- 202.118.66.6
search: []
optional: true


enp8s0:
addresses:
- 192.168.11.66/24
gateway4: 192.168.11.254
nameservers:
addresses:
- 202.118.66.6
search: []
optional: true


version: 2





编辑完后,执行命令:

sudo netplan apply





其中, 网卡  enp7s0  设置为动态获取ip, 网卡 enp8s0  设置为静态ip 。








==================================================================




常用的相关命令:




查看网络设备配置:

ip  a


Ubuntu18.04 server   双网卡,一个设置为静态IP, 一个设置为动态IP_javascript











查看网络硬件:

lspci |grep Eth


Ubuntu18.04 server   双网卡,一个设置为静态IP, 一个设置为动态IP_ide_02









举报

相关推荐

0 条评论