如何找到您的服务器公共IP地址的子网?

如何找到您的服务器公共IP地址的子网?

我找到了这个答案:

通过 OpenVPN 使用 NordVPN 服务器连接到 VPN 服务器后如何允许 SSH 进入终端?

ip rule add from x.x.x.x table 128
ip route add table 128 to y.y.y.y/y dev eth0
ip route add table 128 default via z.z.z.z

其中 xxxx 是您的服务器公共 IP,yyyy/y 应该是您的服务器公共 IP 地址的子网,eth0 应该是您的服务器公共以太网接口 zzzz 应该是默认网关。

我怎样才能找到这些值? (xxxx / yyyy / y / eth0 / zzzz)?

ifconfig
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 51.15.170.195  netmask 255.255.255.0  broadcast 51.15.170.255
        inet6 fe80::208:a2ff:fe0b:3e12  prefixlen 64  scopeid 0x20<link>
        ether 00:08:a2:0b:3e:12  txqueuelen 1000  (Ethernet)
        RX packets 5029  bytes 1043720 (1019.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1143  bytes 164109 (160.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xdfe00000-dfe7ffff

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 30  bytes 2541 (2.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 2541 (2.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


ip r
default via 51.15.170.1 dev enp1s0
51.15.170.0/24 dev enp1s0 proto kernel scope link src 51.15.170.195

相关内容