您的位置:首页 > 理论基础 > 计算机网络

Ubuntu系统网络配置

2016-12-01 20:35 381 查看
http://jingyan.baidu.com/article/f25ef25414e8ea482d1b8265.html

Ubuntu网络配置如下:Ubuntu上连了两块网卡,eth0为外网的eth1为内网的eth0上IP为自动获取eth1上为手工设置

1、打开Ubuntu的/etc/network/interfaces文件 。默认内容如下

   auto lo iface lo inet loopback 

2、如果以DHCP方式配置网卡,则改为:auto eth0 iface eth0 inet

   dhcp也可以在命令行下直接输入下面的命令来获取地址sudo dhclient eth0

3、如果你想配置静态IP地址,你需要编辑/etc/network/interfaces,并输入以下几行(假设你的网卡是eth0)

sudo vi /etc/network/interfaces

# The primary network interface

auto eth0

iface eth0 inet static   //指定为static

address 192.168.17.110   //IP地址

gateway 192.168.17.1   //网关

netmask 255.255.255.0   //子网掩码

network 192.168.17.0   //这个广播网络 有没有匀可

broadcast 192.168.17.255   //广播 有没有匀可

4、编辑好以后步骤后退出,重新启动你的网络设备

  sudo /etc/init.d/networking restart

5、设置Ubuntu网络配置系统的hostname使用以下命令格式来改系统的hostname,或者直接编辑/etc/hostname sudo hostname xchen 来设置DNS

sudo vi /etc/resolv.conf  

enter the following details  

search test.com  

nameserver 192.168.17.2
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: