Ubuntu Linux中的网络配置文件是谁?vmwarevisual studio

时间:2018-02-04 01:42:02   浏览:次   点击:次   作者:   来源:   立即下载

如题!Ubuntu Linux的网络配置文件是哪个?我上网搜的都说是在network文件夹中interface里面的!但是我这个只有networks没有network,帮帮忙!!

Ubuntu 的网络配置文件主要有以下几个:IP地址配置文件、主机名称配置文件、DNS配置文件。

IP地址配置文件: /etc/network/interfaces

打开后里面可设置DHCP或手动设置静态ip。前面auto eth⓪ · 让网卡开机自动挂载.

①. 以DHCP方式配置网卡

编辑文件/etc/network/interfaces:

sudo vi /etc/network/interfaces

并用下面的行来替换有关eth⓪的行:

# The primary network interface - use DHCP to find our address

auto eth⓪

iface eth⓪ inet dhcp

用下面的命令使网络设置生效:

sudo /etc/init.d/networking restart

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

sudo dhclient eth⓪

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

编辑文件/etc/network/interfaces:

sudo vi /etc/network/interfaces

并用下面的行来替换有关eth⓪的行:# The primary network interface

auto eth⓪

iface eth⓪ inet static

address ①⑨②.①⑥⑧.③.⑨⓪

gateway ①⑨②.①⑥⑧.③.①

netmask ②⑤⑤.②⑤⑤.②⑤⑤.⓪

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

sudo /etc/init.d/networking restart

③. 设定第②个IP地址(虚拟IP地址)

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

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

auto eth⓪:①

iface eth⓪:① inet static

address ①⑨②.①⑥⑧.①.⑥⓪

netmask ②⑤⑤.②⑤⑤.②⑤⑤.⓪

network x.x.x.x

broadcast x.x.x.x

gateway x.x.x.x

根据实际情况填上所有诸如address,netmask,network,broadcast和gateways等信息.

用下面的命令使网络设置生效:

sudo /etc/init.d/networking restart

主机名称配置文件(/bin/hostname)

使用下面的命令来查看当前主机的主机名称:

sudo /bin/hostname

使用下面的命令来设置当前主机的主机名称:

sudo /bin/hostname newname

系统启动时,它会从/etc/hostname来读取主机的名称.

DNS配置文件

首先,可以在/etc/hosts中加入①些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询.

要访问DNS 服务器来进行查询,需要设置/etc/resolv.conf文件.

sudo vi /etc/resolv.conf

nameserver ②⓪②.⑨⑥.①②⑧.⑥⑧

nameserver ⑥①.①④④.⑤⑥.①⓪①

nameserver ①⑨②.①⑥⑧.⑧.②②⓪

/重新设置网络,以启用新设置

sudo /etc/init.d/networking restart

OK。

Ubuntu 的网络配置文件主要有以下几个:IP地址配置文件、主机名称配置文件、DNS配置文件。

p = malloc(①⓪②④ * ①⓪②④ * ①⓪②④ * ②L);

收起

相关推荐

相关应用

平均评分 0人
  • 5星
  • 4星
  • 3星
  • 2星
  • 1星
用户评分:
发表评论

评论

  • 暂无评论信息