Ubuntu16固定IP的修复

lshw -C network #查看网卡的信息   
#ifconfig enp15s0 固定ip netmask 255.255.255.0 #临时固定ipi地址
/etc/init.d/networking stop
cp /etc/network/interfaces /etc/network/interfaces.bak
### enp15s0和enp14s0是一个网卡的两个接口
vim /etc/network/interfaces
#添加如下    
auto enp15s0
auto enp14s0
iface enp14s0 inet dhcp   #动态ip
iface enp15s0 inet static #固定ip
address 固定ip地址
netmask 255.255.255.0

vim /etc/hosts
固定ip地址    bioinf.njnu.edu.cn

vim /etc/resolv.conf #设置DNS解析---个人觉得可以不用 
nameserver 固定ip地址

ifconfig enp14s0 up
dhclient enp14s0     
ifconfig enp15s0 up
/etc/init.d/networking start


注意:因为这里的enp14s0是可以链接外网的接口,所以需要先将电脑链接到外网,然后启动enp15s0是将网卡的另一个接口绑定固定ip,由于并未设定链接规则,所以外网可以直接访问此固定ip,若需要制定访问规则可以自己根据规则定义
此条目发表在Linux分类目录。将固定链接加入收藏夹。

发表评论

邮箱地址不会被公开。 必填项已用*标注

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

Protected with IP Blacklist CloudIP Blacklist Cloud