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

查看网络硬件:
lspci |grep Eth

相关资料:
https://www.cnblogs.com/devilmaycry812839668/p/13994054.html
https://www.cnblogs.com/devilmaycry812839668/p/10254971.html
https://blog.csdn.net/songyuequan/article/details/89437405
    本博客是博主个人学习时的一些记录,不保证是为原创,个别文章加入了转载的源地址,还有个别文章是汇总网上多份资料所成,在这之中也必有疏漏未加标注处,如有侵权请与博主联系。
如果未特殊标注则为原创,遵循 CC 4.0 BY-SA 版权协议。
posted on 2021-08-03 19:38 Angry_Panda 阅读(1064) 评论(1) 收藏 举报
 
                     
                    
                 
                    
                 
                
            
         
         
 浙公网安备 33010602011771号
浙公网安备 33010602011771号