本文主要是介绍修改网卡,网关ip,校园网,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、使用校园网的脚本程序:
环境:树莓派,debian10,
修改文件:wpa_supplicant.conf
/etc/wpa_supplicant/目录下的:wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=CNnetwork={ssid="BUPT-mobile"key_mgmt=WPA-EAPpairwise=CCMP TKIPgroup=CCMP TKIPeap=PEAP TTLSscan_ssid=1identity="2019180100" # 学号password="QWEasd321~" # 密码phase1="PEAP"phase2="MSCHAPV2"priority=1proactive_key_caching=1
}
之后使用如下命令获取动态ip:
sudo killall wpa_supplicant
sudo wpa_supplicant -dd -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
另开一个窗口:
ifconfig #查看网卡wlan0 的ip和子网掩码,然后计算网关
2、固定wlan0通过wifi获取来的ip
修改文件:/etc/dhcpcd.conf
# Example static IP configuration:
interface eth0
static ip_address=192.168.0.2/24
static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1 # 注释掉这个集群局域网的网关
static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1interface wlan0
static ip_address=10.28.210.35/17
static routers=10.28.128.1 # 使用这个网关
static domain_name_servers=10.28.128.1 8.8.8.8
设置树莓派网关绑定的网卡:
eht0 -->wlan0
# Example static IP configuration:
interface eth0
static ip_address=192.168.0.47/24
static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1interface wlan0
static ip_address=10.28.165.172/17
static routers=10.28.128.1
static domain_name_servers=10.28.128.1 8.8.8.810.28.165.172/17 子网掩码:255.255.128.1,165比128大?
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 10.28.210.35 netmask 255.255.128.0 broadcast 10.28.255.255inet6 2001:da8:215:3c02::b688 prefixlen 128 scopeid 0x0<global>inet6 fe80::c628:92be:6836:3eea prefixlen 64 scopeid 0x20<link>ether dc:a6:32:94:02:c3 txqueuelen 1000 (Ethernet)RX packets 169 bytes 17735 (17.3 KiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 445 bytes 61708 (60.2 KiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
这篇关于修改网卡,网关ip,校园网的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!