“Debian配置网络”的版本间的差异

来自linux中国网wiki
跳到导航 跳到搜索
(导入1个版本)
 
(未显示同一用户的5个中间版本)
第22行: 第22行:
 
</pre>
 
</pre>
  
=my eg=
+
=my eg debian10=
 
<pre>
 
<pre>
# The primary network interface
+
 
 +
#要先确定你的网络接口为 enp0s3 也可能是其它
 +
# The primary network interface 2020
 
auto enp0s3
 
auto enp0s3
 
allow-hotplug enp0s3
 
allow-hotplug enp0s3
第34行: 第36行:
 
auto lo
 
auto lo
 
iface lo inet loopback
 
iface lo inet loopback
 +
 +
 +
#on ss
 +
auto lo
 +
iface lo inet loopback
 +
 +
# The primary network interface
 +
auto enp0s3
 +
allow-hotplug enp0s3
 +
iface enp0s3 inet static
 +
address 192.168.10.70
 +
netmask 255.255.255.0
 +
gateway 192.168.10.1
 +
 +
 +
 +
 +
#on lx
 +
auto lo
 +
iface lo inet loopback
 +
 +
# The primary network interface
 +
auto ens192
 +
allow-hotplug ens192
 +
iface ens192 inet static
 +
address 192.168.10.193
 +
#address 192.168.11.193
 +
netmask 255.255.254.0
 +
gateway 192.168.10.1
 +
# This is an autoconfigured IPv6 interface
 +
iface ens192 inet6 auto
  
 
</pre>
 
</pre>
 +
 
=参考=
 
=参考=
 
[https://www.debian.cn/archives/1246 Debian中如何设置静态IP地址 ]
 
[https://www.debian.cn/archives/1246 Debian中如何设置静态IP地址 ]

2021年11月16日 (二) 07:14的最新版本

 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).

source /etc/network/interfaces.d/*

# The loopback network interface
auto enp0s3 # #设置开机自动连接网络
allow-hotplug enp0s3
iface enp0s3 inet static #static表示使用固定IP地址上网,dhcp表示使用动态ip
address 192.168.88.3  #设置静态ip地址
netmask 255.255.255.0 #子网掩码
gateway 192.168.88.1  #网关

auto lo
iface lo inet loopback

#重启网络不成功
service networking restart

my eg debian10


#要先确定你的网络接口为 enp0s3 也可能是其它
# The primary network interface 2020
auto enp0s3
allow-hotplug enp0s3
iface enp0s3 inet static 
address 192.168.88.68 
netmask 255.255.255.0 
gateway 192.168.88.1 

auto lo
iface lo inet loopback


#on ss
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
allow-hotplug enp0s3
iface enp0s3 inet static 
address 192.168.10.70
netmask 255.255.255.0 
gateway 192.168.10.1 




#on lx
auto lo
iface lo inet loopback

# The primary network interface
auto ens192
allow-hotplug ens192
iface ens192 inet static 
address 192.168.10.193 
#address 192.168.11.193 
netmask 255.255.254.0 
gateway 192.168.10.1 
# This is an autoconfigured IPv6 interface
iface ens192 inet6 auto

参考

Debian中如何设置静态IP地址

debian9.x配置网络