linux ipv6地址与默认网关静态设置示例

发布时间:2020-11-02编辑:脚本学堂
本文介绍了linux下ipv6地址与默认网关的设置方法,默认网关怎么设置,ipv6地址如何设置,有需要的朋友参考下。

本节内容:
linux下设置ipv6地址与默认网关

操作步骤:
 

复制代码 代码示例:

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
device=eth0
bootproto=none
broadcast=192.168.0.255
hwaddr=00:a0:d1:e4:03:32
ipaddr=192.168.0.1
# ipv6地址
ipv6addr=2001:da8:3000::183
ipv6prefix=64
ipv6_autoconf=no
netmask=255.255.255.0
network=192.168.0.0
onboot=yes
type=ethernet
[root@localhost ~]# vi /etc/sysconfig/network
networking=yes
networking_ipv6=yes
hostname=localhost
# ipv6网关
ipv6_defaultgw=2001:da8:3000::1%eth0
debian/ubuntu

vi /etc/network/interfaces
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# the loopback interface
# automatically added when upgrading
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet6 static
# ipv6地址
address 2001:da8:3000::181
netmask 64
# ipv6网关
up route -a inet6 add default gw 2001:da8:3000::1 dev $iface
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
up route add default gw 192.168.0.1 dev $iface

如此便完成了linux操作系统中ipv6地址与默认网关的设置,希望对你有所帮助。