Advertisement

Linux下修改IP-DNS-Routing的命令行设置

阅读量:

一、快速修改,重启后设置就没了

执行ifconfig命令为eth0接口配置IP地址192.168.1.22,并设置子网掩码为255.255.255.0,同时启用该网络接口;随后通过route命令添加默认路由,将网关地址设定为192.168.1.2。

二、修改配置文件,重启设置还在

(一)ubuntu 版本命令行设置IP

查看/etc/network/interfaces文件内容

系统网络接口描述

接口激活方法与信息指引

The loopbacknetwork interface

auto lo
iface lo inet loopback

The primarynetwork interface

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1

在/etc/resolv.conf文件中追加以下内容:
nameserver 192.168.1.1
nameserver 220.170.64.68

执行网卡重启操作:/etc/init.d/networking restart

更新说明: 自Ubuntu版

全部评论 (0)

还没有任何评论哟~