Debian10 系统如何配置网卡?

Debian10 系统如何配置网卡?

一、网络配置

由于Debian10的vi是精简版不好用所以先配置一下镜像源安装vim

打开vi /etc/apt/sources.list输入以下内容(i键输入,删除键不好用最好一次性输入对,删除按delete键):

imgSpider 采集中…

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

 

# 打开网卡文件

vim /etc/network/interfaces

 

填入内容

 

auto ens33 # 网卡随系统自动启动

iface ens33 inet static # 网卡为静态ip地址

address 192.168.2.86 # 设置ip地址

netmask 255.255.255.0 # 子网掩码

gateway 192.168.2.1 # 网关

dns-nameservers 223.5.5.5 223.6.6.6 # DNS

 

注意:vim /etc/resolv.conf 的nameservers是否配置正确

 

重启网络服务

 

service networking restart

# 或者

systemctl restart networking

 

二、设置镜像源

以Buster为例, 编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份)

 

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服务

apt-get install openssh-server -y

 

配置vim /etc/ssh/sshd_config文件,使root可以远程登录

 

PermitRootLogin yes # 设置为yes

PasswordAuthentication yes # 是否允许使用基于密码的认证

 

重启ssh服务

 

systemctl restart sshd

四、安装VMtools

apt-get install open-vm-tools

五、设置代理

环境变量 描述 示例

http_proxy 为http变量设置代理;默认不填开头以http协议传输 192.168.1.1:8080

user:[email protected]:8080

socks4://192.168.1.1:8080

socks5://192.168.1.1:1080

https_proxy 为https变量设置代理 同上

ftp_proxy 为ftp变量设置代理 同上

all_proxy 全部变量设置代理,设置了这个时候上面的不用设置 同上

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

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/156365.html<

(0)
运维的头像运维
上一篇2025-03-15 21:19
下一篇 2025-03-15 21:20

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注