Linux IPv6地址和默认网关的静态设置

Redhat/CentOS/Fedora

[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

 

2 Replies to “Linux IPv6地址和默认网关的静态设置”

  1. Pingback: dr berg keto diet
  2. Pingback: gay dating com

Leave a Reply

Your email address will not be published.