ubuntu修改50-cloud-init.yaml(幻宇机器人打开有限网卡)

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

 原先的文件内容:

huike@huike:/etc/netplan$ cat 50-cloud-init.yaml
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  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:
        eth0:
            dhcp4: true
            optional: true
    version: 2

改变后的:

假设IP地址修改为192.168.1.103,

子网掩码24位即255.255.255.0,16位即255.255.0.0;8位即255.0.0.0;

网关设置为192.168.1.1,

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  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:
        eth0:
            addresses: [192.168.1.103/24]
            gateway4: 192.168.1.1
            dhcp4: no
            optional: true
    version: 2

应用:

sudo netplan apply

执行ifocnfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
        ether b8:27:eb:e9:8e:b7  txqueuelen 1000  (Ethernet)
        RX packets 274  bytes 18372 (18.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 356  bytes 63867 (63.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

参考:

假设IP地址修改为192.168.1.100,子网掩码24位即255.255.255.0,网关设置为192.168.1.1,DNS1:223.5.5.5,DNS2:223.6.6.6

1

2

3

4

5

6

7

8

9

10

11

network:

    ethernets:

        ens33:

            dhcp4: no

            addresses: [192.168.1.100/24]

            optional: true

            gateway4: 192.168.1.1

            nameservers:

                    addresses: [223.5.5.5,223.6.6.6]

    version: 2

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值