静态IP配置_Ubuntu 14.04

我在Ubuntu Server 14.04 LTS上设置静态IP时遇到问题。

我的电脑有2个接口p2p1p1p1p2p1节点 – 主节点 – 应该在外部世界中可见。

我使用以下代码来配置IP。

 auto lo iface lo inet loopback auto p2p1 iface p2p1 inet static address 192.168.2.202 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 gateway 192.168.2.1 dns-nameservers 192.168.2.1 auto p1p1 address 192.168.2.203 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 gateway 192.168.2.1 dns-nameservers 192.168.2.1 

但是,在网络配置不起作用后没有互联网并且ping www.google.com无效。

早些时候我使用过Ubuntu 12.04,它有eth0eth1 ,我没有更多关于ubuntu的经验。

我有两个问题。

  1. ubuntu 12.04中的eth0和ubuntu 14.04中的p2p1是相同的。
  2. 如何在Ubuntu 14.04上配置两个网卡使用
    • p2p1用于万维网服务
    • p1p1用于FTP和VPN连接。

我不认为有网关是好的,

 auto lo iface lo inet loopback auto p2p1 iface p2p1 inet static address 192.168.2.202 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 #gateway 192.168.2.1 #dns-nameservers 192.168.2. auto p1p1 address 192.168.2.203 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 gateway 192.168.2.1 #dns-nameservers 192.168.2 

而不是将dns-nameservers服务器放在网络接口中,尝试更改/etc/resolvconf/resolv.conf.d/base ,如下所示:

 # Google IPv4 nameservers nameserver 8.8.8.8 nameserver 8.8.4.4 

您还需要运行resolvconf -u才能反映更改。

问题是为静态IP与动态IP地址的dnsmasq设置了不同的标志。

对于静态IP地址,dnsmasq默认设置–proxy-dnssec。 大多数ISP不提供支持dnssec的DNS服务器,因此dnsmaq挂起。

如果您将DNS服务器的IP地址设置为公开提供的DNS服务器(谷歌是一个很好的:8.8.8.8,8.8.4.4)一切都会工作。 您无需以任何其他方式覆盖resolve。