debian 配置静态ip
- 查看虚拟机上本机ip
cmd→ipconfig
- 配置网卡
2.1 备份原有配置文件配置文件
cp /etc/network/interfaces /etc/network/interfacesbak #备份原有配置文件
2.2 编辑interfaces
vim /etc/network/interfaces #编辑网卡配置文件
auto lo #开机自动连接网络
iface ens32 inet static #static表示使用固定ip,dhcp表述使用动态ip
address 192.168.21.166 #设置ip地址 【为ipconfig中地址一致,最后一位端口改前ping一下确定端 口没人用】
netmask 255.255.255.0 #设置子网掩码
gateway 192.168.21.2 #设置网关
iface ens32 inet static
address 192.168.21.166
netmask 255.255.255.0
gateway 192.168.21.2
2.3 重启网卡
/etc/init.d/networking restart
- 配置DNS
3.1 备份dns配置文件
cp /etc/resolv.conf /etc/resolv.confbak #备份原有dns配置文件3.2 编辑配置文件
vim /etc/resolv.conf
3.3 编辑配置文件
注: nameserver:设置dns第一个为首选,第二个备用dns
注意dns和网关保持一致
3.4 重启网络
service networking restart # 重启网络
看到ens32的地址通了。
`ping 168.68.62.1
ping www.baidu.com`
- 使用git管理
安装SSH Server
在debian命令行下,输入$ sudo apt-get install ssh openssh-server
即可安装SSH,安装完了SSH之后,我们就可以使用putty或xshell来连接虚拟机中的debian了。
服务器上打开虚拟机上101的镜像后,本机git中输入
$ ssh [email protected]
nmcli -help