Ubuntu网卡IP设置

系统 Linux
本文主要是教大家如何在Ubuntu系统下设置网卡的IP地址,相信对于许多使用Ubuntu系统的新手来说应该会有很大的帮助!

Ubuntu里网卡IP设置的步骤:

1.单网卡配单IP(普遍)

 

  1. vi /etc/network/interface  
  2. auto eth0  
  3. iface eth0 inet static  
  4. address IP  
  5. netmask 子网掩码  
  6. gateway 网关  

2.单网卡双IP (情况较少,多用于区分服务或者安全隐藏)

 

  1. vi /etc/network/interface  
  2. auto eth0:0  
  3. iface eth0:0 inet static  
  4. address IP  
  5. netmask 子网掩码  
  6. gateway 网关  
  7. auto eth0:1  
  8. iface eth0:1 inet static  
  9. address IP  
  10. netmask 子网掩码  
  11. gateway 网关 

3.双网卡双IP(应用情况较多,一般为一个内网一个为外网)

 

  1. auto eth0  
  2. iface eth0 inet static  
  3. address IP  
  4. netmask 子网掩码  
  5. gateway 网关  
  6. auto eth1  
  7. iface eth1 inet static  
  8. address IP  
  9. netmask 子网掩码  
  10. gateway 网关 

综上,配置后保存推出,一般需要重启下网卡才能设置生效,方法很多,比如ifdown eth0 ,ifup eth0,最直接的方法直接在终端键入/etc/init.d/networking restart www.kissgz.com

至于DNS,都是一样的,如下

 

  1. vi /etc/resolv.conf(实际系统默认的并不存在resolv.conf该文件,属于自己创建)  
  2. nameserver 主DNS  
  3. nameserver 后备DNS 
【编辑推荐】
责任编辑:冯宇 来源: ChinaUnix文档频道
相关推荐

2016-01-07 14:02:55

Ubuntu 15.1网卡 IP地址

2010-01-07 14:22:17

Ubuntu IP地址

2010-02-22 08:56:30

Ubuntu DNS

2011-09-09 10:37:27

UbuntuinterfaceStun server

2013-11-27 11:16:09

Ubuntu技巧

2022-10-27 10:02:58

UbuntuLinux

2010-02-22 13:31:32

Ubuntu安装

2011-08-30 15:19:23

2010-02-22 15:59:48

2010-07-26 13:44:33

Ubuntu teln

2010-03-05 15:14:55

Ubuntu网络配置

2011-09-08 11:07:25

Ubuntu蓝牙

2011-02-22 09:04:57

DebianBonding双网卡单IP

2010-01-04 15:49:11

Ubuntu Serv

2011-09-09 10:59:03

2010-02-05 12:59:19

Ubuntu IP

2010-01-06 18:40:10

Ubuntu无线网卡

2010-01-04 13:29:37

2010-02-07 14:41:28

Ubuntu 8.10

2010-09-09 17:37:48

Ubuntu tftp
点赞
收藏

51CTO技术栈公众号