1. Ubuntu18.04 修改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:
enp0s3:
addresses: [192.168.33.34/24]
gateway4: 192.168.33.1
dhcp4: no
version: 2
复制代码
运行sudo netplan apply
使配置生效,通过ifconfig
查看ip是否配置成功
2. 查看网关
route -n
netstat -r
复制代码
3. 防火墙开启/关闭
ufw enable
ufw disable
复制代码