linux (debian) 配置静态ip
2014-10-28 11:14
337 查看
在局域网内使用动态ip分配,机器动态的获取
ip地址。但是我使用ssh登录的时候,总是断线。
后来发现,原来机器总是在两个ip地址192.168.2.203
和192.168.2.228之间切换,用ssh登录老师断线,实在
在是受不了了,所以决定配置静态ip。
配置静态ip涉及到两个文件,/etc/network/interface
和/etc/resolv.conf,两个文件的配置如下:
====================================
/etc/network/interface文件配置:
# 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
auto eth2
iface eth2 inet static
address 192.168.2.2 # 注 :静态ip必须在100之前
netmask 255.255.255.0
gateway 192.168.2.1
broadcast 192.168.2.255
====================================
/etc/resolv.conf文件配置:
nameserver 192.168.2.1 # 一般和gateway的地址是一致的
====================================
重启网络: sudo /etc/init.d/networking restart
ip地址。但是我使用ssh登录的时候,总是断线。
后来发现,原来机器总是在两个ip地址192.168.2.203
和192.168.2.228之间切换,用ssh登录老师断线,实在
在是受不了了,所以决定配置静态ip。
配置静态ip涉及到两个文件,/etc/network/interface
和/etc/resolv.conf,两个文件的配置如下:
====================================
/etc/network/interface文件配置:
# 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
auto eth2
iface eth2 inet static
address 192.168.2.2 # 注 :静态ip必须在100之前
netmask 255.255.255.0
gateway 192.168.2.1
broadcast 192.168.2.255
====================================
/etc/resolv.conf文件配置:
nameserver 192.168.2.1 # 一般和gateway的地址是一致的
====================================
重启网络: sudo /etc/init.d/networking restart
相关文章推荐
- linux (debian) 配置静态ip
- debian linux静态IP设置。
- 使用linux作为服务器,配置静态ip
- Debian中配置静态IP
- 【Linux】VMware虚拟机中如何配置静态IP
- Linux下自动获取和静态配置IP的方法
- linux 配置静态IP 弹出eth0 失败
- debian配置静态ip
- linux 配置静态IP
- Hadoop学习笔记_linux网络配置及静态ip设置
- 搭建linux服务器之Debian设置静态IP
- Debian中配置静态IP
- 详述Linux配置静态IP、设置DNS和主机名
- linux 配置静态ip
- Linux配置静态IP
- Linux下配置静态IP 设置DNS和主机名
- 详述Linux配置静态IP、设置DNS和主机名
- 详述Linux配置静态IP、设置DNS和主机名
- 在linux下配置静态IP
- Hadoop学习笔记_linux网络配置及静态ip设置