码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu系统-网络配置

时间:2018-04-06 23:55:30      阅读:359      评论:0      收藏:0      [点我收藏+]

标签:server   package   orm   ddr   describes   文件   roo   use   etc   

网络配置

静态IP

root@ubuntu:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens33
iface ens33 inet static
    address 10.0.0.50
    netmask 255.255.255.0
    network 10.0.0.0
    broadcast 10.0.0.255
    gateway 10.0.0.2
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 10.0.0.

DHCP动态IP

 以DHCP方式配置网卡

编辑文件
vi /etc/network/interfaces 并用下面的行来替换有关eth0的行: # The primary network interface - use DHCP to find our address auto eth0 iface eth0 inet dhcp

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

/etc/init.d/networking restart

设置主机名称(hostname)

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

vim /bin/hostname

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

 配置DNS

vim /etc/resolv.conf

Ubuntu系统-网络配置

标签:server   package   orm   ddr   describes   文件   roo   use   etc   

原文地址:https://www.cnblogs.com/syaving/p/8729269.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!