Debian10 系統(tǒng)如何配置網(wǎng)卡?
一、網(wǎng)絡(luò)配置
由于Debian10的vi是精簡版不好用所以先配置一下鏡像源安裝vim
打開vi /etc/apt/sources.list輸入以下內(nèi)容(i鍵輸入,刪除鍵不好用最好一次性輸入對,刪除按delete鍵):
deb http://mirrors.163.com/debian/ buster main non-free contrib
# 適用于所有版本
deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
然后更新鏡像源apt-get update
安裝vim:apt-get install vim -y
# 打開網(wǎng)卡文件
vim /etc/network/interfaces
填入內(nèi)容
auto ens33 # 網(wǎng)卡隨系統(tǒng)自動啟動
iface ens33 inet static # 網(wǎng)卡為靜態(tài)ip地址
address 192.168.2.86 # 設(shè)置ip地址
netmask 255.255.255.0 # 子網(wǎng)掩碼
gateway 192.168.2.1 # 網(wǎng)關(guān)
dns-nameservers 223.5.5.5 223.6.6.6 # DNS
注意:vim /etc/resolv.conf 的nameservers是否配置正確
重啟網(wǎng)絡(luò)服務(wù)
service networking restart
# 或者
systemctl restart networking
二、設(shè)置鏡像源
以Buster為例, 編輯/etc/apt/sources.list文件, 在文件最前面添加以下條目(操作前請做好相應(yīng)備份)
deb http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib
也可訪問http://mirrors.163.com/.help/debian.html
apt-get update # 更新
三、安裝ssh服務(wù)
apt-get install openssh-server -y
配置vim /etc/ssh/sshd_config文件,使root可以遠程登錄
PermitRootLogin yes # 設(shè)置為yes
PasswordAuthentication yes # 是否允許使用基于密碼的認證
重啟ssh服務(wù)
systemctl restart sshd
四、安裝VMtools
apt-get install open-vm-tools
五、設(shè)置代理
環(huán)境變量 描述 示例
http_proxy 為http變量設(shè)置代理;默認不填開頭以http協(xié)議傳輸 192.168.1.1:8080
user:pass@192.168.1.1:8080
socks4://192.168.1.1:8080
socks5://192.168.1.1:1080
https_proxy 為https變量設(shè)置代理 同上
ftp_proxy 為ftp變量設(shè)置代理 同上
all_proxy 全部變量設(shè)置代理,設(shè)置了這個時候上面的不用設(shè)置 同上
no_proxy 無需代理的主機或域名;
可以使用通配符;
多個時使用“,”號分隔;
.aiezu.com,10...,192.168..,*.local,localhost,127.0.0.1
export http_proxy=http://IP地址:端口號
export https_proxy=http://user:password@IP地址:端口號
export ftp_proxy=http://IP地址:端口號
export no_proxy="localhost,127.0.0.1"
# 永久配置需要配置/etc/profile
六、取消代理
unset http_proxy
unset https_proxy
unset ftp_proxy
unset no_proxy