ubuntu 配置静态ip地址

来源:互联网 发布:马泰尔家族知乎 编辑:程序博客网 时间:2024/05/22 17:23

1  配置静态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).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface

#以下是静态ip地址配置

auto eth0
iface eth0 inet static
        address 10.0.0.10                                            
        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 8.8.8.8


2 DNS配置

root@ubuntu:~# vi /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 202.96.128.86

~

原创粉丝点击