Ubuntu网络配置以DHCP方式配置网卡

系统 Linux
Ubuntu网络配置的常用系统,于是我学习研究了Ubuntu网络配置,在这里对大家详细介绍下Ubuntu网络配置应用,希望对大家有用Ubuntu网络配置包含了非常好的翻译和容易使用的架构./etc/network/interfaces打开后里面可设置DHCP或手动设置静态ip。前面auto eth0,让网卡开机自动挂载.

Ubuntu网络配置的常用系统,于是我学习研究了Ubuntu网络配置,在这里对大家详细介绍下Ubuntu网络配置应用,希望对大家有用Ubuntu网络配置包含了非常好的翻译和容易使用的架构./etc/network/interfaces打开后里面可设置DHCP或手动设置静态ip。前面auto eth0,让网卡开机自动挂载.

1. 以DHCP方式配置网卡

编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces

并用下面的行来替换有关eth0的行:
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp

用下面的命令使网络设置生效:sudo /etc/init.d/networking restart也可以在命令行下直接输入下面的命令来获取地址sudo dhclient eth0

2. 为网卡配置静态IP地址

编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces并用下面的行来替换有关eth0的行:# The primary network interface

  1. auto eth0  
  2. iface eth0 inet static  
  3. address 192.168.3.90  
  4. gateway 192.168.3.1  
  5. netmask 255.255.255.0  
  6. #network 192.168.3.0  
  7. #broadcast 192.168.3.255 

将上面的ip地址等信息换成你自己就可以了.用下面的命令使网络设置生效:sudo /etc/init.d/networking restart

3. 设定第二个IP地址(虚拟IP地址)

编辑文件/etc/network/interfaces:sudo vi /etc/network/interfaces

在该文件中添加如下的行:

  1. auto eth0:1  
  2. iface eth0:1 inet static  
  3. address 192.168.1.60  
  4. netmask 255.255.255.0  
  5. network x.x.x.x  
  6. broadcast x.x.x.x  
  7. gateway x.x.x.x 

根据你的情况填上所有诸如address,netmask,network,broadcast和gateways等信息.用下面的命令使网络设置生效:sudo /etc/init.d/networking restart

4. 设置主机名称(hostname)

使用下面的命令来查看当前主机的主机名称:sudo /bin/hostname使用下面的命令来设置当前主机的主机名称:sudo /bin/hostname newname系统启动时,它会从/etc/hostname来读取主机的名称.关于设置主机名称的更多信息,请访问这里

5. 配置DNS

首先,你可以在/etc/hosts中加入一些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询.要访问DNS 服务器来进行查询,需要设置/etc/resolv.conf文件.假设DNS服务器的IP地址是192.168.3.2, 那么/etc/resolv.conf文件的内容应为:
search test.com
nameserver 192.168.3.2

以上介绍Ubuntu网络配置。

【编辑推荐】

  1. Ubuntu网络配置静态IP与hostname使用命令
  2. Ubuntu网络配置软件源
  3. 安装Ubuntu网络设置连接配置
  4. Ubuntu网络安装的优缺点与安装步骤
  5. Ubuntu硬盘分区和分区文件类型及Linux分区基础知识
责任编辑:佚名 来源: 博客园
相关推荐

2010-03-05 15:24:42

Ubuntu网络配置

2010-01-07 14:22:17

Ubuntu IP地址

2010-02-22 13:31:32

Ubuntu安装

2009-09-21 09:49:14

Ubuntu Serv网络配置操作系统

2010-03-05 15:05:46

Ubuntu网络配置

2010-09-01 15:09:39

ubuntutftpdhcp

2010-02-06 15:50:00

Ubuntu网络

2010-08-23 17:57:43

交换机配置dhcp

2010-01-06 18:40:10

Ubuntu无线网卡

2011-01-18 09:41:21

Linux网卡

2010-01-04 17:25:34

Ubuntu安装

2010-01-08 17:03:58

Ubuntu网络设置

2010-09-29 14:41:42

Suse DHCP配置

2010-09-26 14:52:22

DHCP Snoopi

2010-03-11 09:20:54

Ubuntu网络配置

2014-08-08 14:26:13

​i​f​c​o​n​linux

2010-08-26 16:53:41

配置DHCP

2010-08-30 19:55:27

配置DHCP

2022-07-10 20:48:36

DHCP互联网网络

2010-09-06 13:00:41

无线网络ubuntu
点赞
收藏

51CTO技术栈公众号