csx 发表于 2021-11-19 11:55

Linux下IPv6地址配置

Debian
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

   address 2001:da8:2:10d::2

   netmask 64

   up route -A inet6 add default gw 2001:da8:2:10d::1 dev $IFACE

iface eth0 inet static

   address 58.1.4.74

   netmask 255.255.255.0

up route add default gw 58.1.4.1 dev $IFACE

Redhat CentOS Fedora
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

# Broadcom Corporation NetXtreme BCM5704 Gigabit Ethernet

DEVICE=eth0

BOOTPROTO=none

HWADDR= 00:09 :3D:22:E1:40

IPADDR=202.120.1.1

NETMASK=255.255.255.240

ONBOOT=yes

GATEWAY=202.120.1.254

TYPE=Ethernet

USERCTL=no

IPV6INIT=yes

PEERDNS=yes

IPV6ADDR=2001:da8:8003:801:202:120:1:1

静态默认网关设置
# vi /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=yes

HOSTNAME=server4

GATEWAY=202.120.1.254

IPV6_DEFAULTGW=2001:da8:8003:801::1%eth0
页: [1]
查看完整版本: Linux下IPv6地址配置