在局域网内使用动态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


 

相关文章:

  • 2021-11-26
  • 2021-03-31
  • 2021-12-13
  • 2022-01-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-12
  • 2021-12-04
  • 2021-07-24
  • 2021-10-19
相关资源
相似解决方案