miller
发布于

ubuntu 新版 网络配置 + 屏蔽ipv6

pve 下vm装的ubuntu

  • ls /etc/netplan/
    vim 00-installer-config.yaml
miller@ubuntu01:/etc/netplan$ cat 00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens18:
      dhcp4: false
      addresses: [192.168.1.104/24]
      routes:
        - to: default
          via: 192.168.1.100
      nameservers:
        addresses: [1.1.1.1,8.8.8.8]
  version: 2
  • sudo netplan try 测试配置文件
  • 生效 sudo systemctl restart systemd-networkd
  • ip a

屏蔽ipv6

step1 vim /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

sudo sysctl -p 生效

step2 vim /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

sudo update-grub
sudo reboot

浏览 (151)
点赞
收藏
评论