Ubuntu10.04 网络问题解决记录

以前的虚拟机环境,由于时间长了网络配置变化导致现在上不网,现把解决过程记录如下:

前提:

  本机window7:Ip为192.168.1.5;网关为192.168.1.1;  虚拟机通过Bridge与本机进行桥接上网。

过程:
1、创建Bridge桥接配置:

Edit -> Virtual network editor, 添加一个Bridged类型的网络或直接修改其中一个为Bridged类型,并在Bridged to位置选择本机使用的网卡;确定退出。

2、设置虚拟系统的网络为Bridged:

通过VM -> Settings -> hardware -> Network adapter中,选择network connection类型中的Bridged;确定退出。

3、启动虚拟机,通过命令ifconfig 查看现在启动的网络设备及其配置

如有设备如下,则跳过第4、5步,直接进行第6步配置网络ip和网关就行。

eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet6 addr: xxxx:xxxx:xxxx:xxxx:xxxx/64 Scope:Link
          ...
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Hos
          ...
如 只能看到一个lo项(如下),则按照第4步用ifconfig -a继续查看本机有的网卡设备

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Hos
          ...

4、通过ifconfig -a命令

可以查看所有网卡设备即使没有启动;如下

eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet6 addr: xxxx:xxxx:xxxx:xxxx:xxxx/64 Scope:Link
          ...
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Hos

5、通过命令vi /etc/network/interfaces修改网络配置

auto eth0
iface eth0 inet dhcp
把自动配置ip改成如下,其中#后为注释项
auto eth0
iface eth0 inet static
address 192.168.1.10
gateway 192.168.1.1
netmask 255.255.255.0
#nameserver  8.8.8.8
nameserver  8.8.8.8#这里是DNS域名,具体情况其ip不一样。
#network 192.168.1.0
#broadcast 192.168.1.255

6、通过vi /etc/resolv.conf命令修改DNS配置

nameserver  8.8.8.8#保持与上面的nameserver配置一致
domain localdomain
search localdomain

7、重启网卡设备

用命令/etc/init.d/networking restart重启网卡设备。

8、用命令reboot重启虚拟机系统

重启后用ifconfig命令查看下,网络配置已经配好且可以上网了。如果没有用命令ifconfig eth0 up/down 启动/关闭网卡 eth0试下。

Ubuntu系统网络配置相关命令有:

http://www.cnblogs.com/luosongchao/archive/2013/05/04/3059402.html

(1)/etc/network/interfaces          这个文件中可以进行IP/掩码/默认网关的配置

(2)/etc/resolv.conf         这个文件包含DNS域名解析的服务器地址

(3)/etc/init.d/networking          这个文件可以重新启动网卡的配置   /etc/init.d/networking restart

具体使用到的命令主要有如下命令:

(1)ifconfig -------查看网卡信息

(2)ifconfig eth0 up/down 启动/关闭网卡 eth0

(3)ifconfig eth0 125.0.0.0 netmask 255.0.0.0   -----配置网卡IP地址

(4)route add default gw 192.168.1.1   -------配置默认路由

(5)/etc/init.d/networking  restart 重启网络配置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值