Ubuntu网络设置详解

  # 根据网上资料整理

  # 方式1和方式4已验证

  # anything the matter, please contact: asksamuel@sina.com

  目录

  方式1:网卡通过DHCP自动获取IP地址

  方式2:网卡静态分配IP地址

  方式3:PPPoE宽带拨号配置

  方式4:通过无线局域网接入互联网

  方式1:网卡通过DHCP自动获取IP地址

  $ sudo gedit /etc/network/interfaces

  # 修改文件/etc/network/interfaces如下文

  #-------------------------------------------------------------------------------

  # This file describes the network interfaces available on your system

  # and how to activate them. For more information, see interfaces(5).

  #

  # The loopback network interface(配置环回口)

  auto lo                                       # 开机自动激lo接口

  iface lo inet loopback                        # 配置lo接口为环回口

  # The primary network interface (配置主网络接口)

  auto eth0                                     #开机自动激活eth0接口

  iface eth0 inet dhcp                          #配置eth0接口为DHCP自动获取

  #-------------------------------------------------------------------------------

  $ sudo /etc/init.d/networking restart           # 重启网络

  方式2:网卡静态分配IP地址

  $ sudo gedit /etc/network/interfaces

  # 修改文件/etc/network/interfaces如下文

  #-------------------------------------------------------------------------------

  # This file describes the network interfaces available on your system

  # and how to activate them. For more information, see interfaces(5).

  #

  # The loopback network interface(配置环回口)

  auto lo                                       # 开机自动激lo接口

  iface lo inet loopback                        # 配置lo接口为环回口

  # The primary network interface (配置主网络接口)

  auto eth0                                     #开机自动激活eth0接口

  iface eth0 inet static                        #配置eth0接口为静态设置IP地址

  address 10.16.3.99

  netmask 255.255.255.0

  network 10.16.3.0

  broadcast 10.16.3.255

  gateway 10.16.3.1

  ####################################################

  ## dns-* options are implemented by the resolvconf package, if installed(DNS设置)

  #dns-nameservers 61.153.177.196 61.153.177.197

  #dns-search fireteam.org

  ####################################################

  #sudo gedit /etc/resolv.conf

  ##设置DNS server(可以设置多个)

  #nameserver 192.168.1.1

  ####################################################

  #-------------------------------------------------------------------------------

  $ sudo /etc/init.d/networking restart    # 重启网络

  方式3:PPPoE宽带拨号配置

  首次拨号:

  应用程序–系统工具–终端  打开一终端,输入命令:

  sudo pppoeconf

  系统开始搜索所有网络接口上的adsl modem,一步步的yes过来。

  │ Please enter the username which you usually need for │

  │ the PPP login to your provider in the input box below. │

  │ If you wish to see the help screen, delete the │

  │ username and press OK. │

  输入你的宽带帐号。

  输入密码。

  tip:如果是河南网通提供的PPPoE宽带帐号,此处输入的是加密后的用户名

  Would you like to add these addresses automatically to the list of nameservers

  in your local /etc/resolv.conf file? (recommended)

  是否自动获得DNS,选择是。

  Should pppoe clamp MSS at 1452 bytes? If unsure, say yes.

  数据包长度的设置,如果跟我一样不确定,选择是

  Your PPPD is configured now. Would you like to start the connection at

  boot time?

  是否启动时自动激活ADSL? 各位看着办吧。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyjzyj.html