为路由器后面的 ubuntu 17.04 服务器创建静态 IP

为路由器后面的 ubuntu 17.04 服务器创建静态 IP

我有以下内容是否配置:-

enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.21.0.11  netmask 255.255.240.0  broadcast 10.21.15.255
        inet6 rr50::9r16:r57r:rrr6:rr86  prefixlen 64  scopeid 0x20<link>
        ether 88:88:rr:8r:b8:88  txqueuelen 1000  (Ethernet)
        RX packets 1283617  bytes 447482292 (447.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 777459  bytes 128121082 (128.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xf7100000-f7120000  

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 62037  bytes 26306447 (26.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 62037  bytes 26306447 (26.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

我的样子也是/etc/network/interfaces这样的:-

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

为了分配静态 IP,我尝试添加类似这样的内容这里:-

auto enp0s31f6
iface enp0s31f6 inet static
   address 10.253.0.50
   netmask 255.255.255.0
   network 10.253.0.0
   gateway 10.253.0.1
   dns-nameservers 8.8.8.8

我使用 sudo 保存它,然后在终端上输入:sudo ifdown enp0s31f6 && sudo ifup enp0s31f6。这不起作用。目标是使 nomachine 能够从外部客户端网络访问此服务器计算机。执行此步骤导致立即失去与服务器的连接。上面的 ifconfig 结果对我来说是希腊语,我从上面的 SO 答案中复制粘贴。如何使其工作?我应该为字段地址、网络掩码、网络、网关提供哪些正确的值。

相关内容