Debian10 系统如何配置网卡?

Debian10 系统如何配置网卡? 一、网络配置 由于Debian10的vi是精简版不好用所以先配置一下镜像源安装vi…

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

为您推荐

Debian系统如何查看端口开放状态

Debian系统如何查看端口开放状态   查看系统端口状态 要查看 Debian 系统上端口的开放状态,可以使...

Debian如何修改IP及DNS?

Debian如何修改IP及DNS? 修改IP地址: 1.编辑文件 vim /etc/network/interfaces...

Debian 11如何编辑的升级到Debian 12

Debian 12 (Codename: Bookworm)是Debian Linux的最新版本,它包含了许多新特性和改...

Linux 的vi和vim 有什么不同?

Linux 的vi和vim 有什么不同? Vi 和 Vim 都是 Linux 中常用的文本编辑器,它们的主要区别在于以下...

各个Linux系统如何修改远程端口ssh端口?

各个Linux系统如何修改远程端口ssh端口?   在 Linux 系统中,可以通过修改 SSH 配置文件来修...
返回顶部