如何在 Ubuntu 16 Server 中配置静态 IP 范围(/22)?

如何在 Ubuntu 16 Server 中配置静态 IP 范围(/22)?

我在 Ubuntu 16 服务器上无法使用 /22 子网。从外部世界,我无法 ping 除 .2 之外分配给 VLAN 的任何 IP

Ubuntu 服务器网络配置:

root@server15:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eno1
iface eno1 inet static
        address xxx.53.16.2
        netmask 255.255.252.0
        network xxx.53.16.0
        broadcast xxx.53.19.255
        gateway xxx.53.16.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers xxx.xxx.33.61 xxx.xxx.33.62
        dns-search domain.com

也尝试过这种方法...除了 .1 和 .2 之外,无法 ping 通任何 IP

root@server:~# ip addr add xxx.53.16.1/22 dev eno1
root@server:~# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether d4:be:d9:ed:fb:8a brd ff:ff:ff:ff:ff:ff
    inet xxx.53.16.2/22 brd xxx.53.19.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet xxx.xxx.16.1/22 scope global secondary eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::d6be:d9ff:feed:fb8a/64 scope link 
       valid_lft forever preferred_lft forever

还在接口中添加了此行,但仍然不起作用

#Add internal route
up route add -net xxx.53.16.0/22 gw xxx.53.16.1 dev eno1

root@server15:~# sudo service networking restart

相关内容