下面以Debian为例,配置多IP和IPv6
- vi /etc/network/interfaces
复制代码
- auto lo
- iface lo inet loopback
-
- auto enp3
- iface enp3 inet static
- address 192.187.88.21/29
- gateway 192.187.88.20
- dns-nameservers 8.8.8.8 8.8.4.4
-
- auto enp3:0
- iface enp3:0 inet static
- address 192.187.88.22/29
-
- auto enp3:1
- iface enp3:1 inet static
- address 192.187.88.23/29
-
- auto enp3:2
- iface enp3:2 inet static
- address 192.187.88.24/29
-
- auto enp3:3
- iface enp3:3 inet static
- address 192.187.88.25/29
-
- iface enp3 inet6 static
- address 2604:2048:a:12a::2/64
- gateway 2604:2048:a:12a::1
- up ip addr add 2604:2048:a:12a::1024/64 dev enp3
- up ip addr add 2604:2048:a:12a::1025/64 dev enp3
复制代码
注意网卡名和网关。如上,IPv6可以配置很多,很多个。
最后重启一下网络服务:
- systemctl restart networking
复制代码
|