2009年4月11日星期六

linux静态Ip设置

#ifconfig eth0 192.168.1.10/24 //需要设置的Ip和子网
#route add defualt gw 192.168.1.1 //设置网关
#echo nameserver 192.168.1.1 > /etc/resolv.conf

要想每次启动是自动使用上面的IP,编辑/etc/network/interfaces文件如下:


# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# This file is modified by Jackie on Apr 4th, 2008.
####LO##########
# The loopback network interface(配置环回口)
# 开机自动激lo接口
auto lo
# 配置lo接口为环回口
iface lo inet loopback

#####DHCP#########
# The primary network interface (配置主网络接口)
# 开机自动激活eth0接口
auto eth0
# 配置eth0接口为DHCP自动获取
iface eth0 inet dhcp

####Static IP###
# The primary network interface (配置主网络接口)
# 开机自动激活eth0接口
# auto eth0
# 配置eth0接口为静态设置IP地址
# iface eth0 inet static
# address 128.1.1.94
# netmask 255.255.255.0
# gateway 192.168.109.1

#####WLAN#####
# The wireless network interface (配置无线网络接口)
# 开机自动激活wlan0接口
auto wlan0
# 配置wlan0接口为DHCP自动获取
iface wlan0 inet dhcp

####PPPoE####
# The PPPoE network interface (配置宽带接口)
#

没有评论:

发表评论