桥接与net模式
#########################桥接上网模式(感觉上网性能好差)#################################
1、设置网路链接方式:
2、编辑虚拟网路
3、补充dns应该为:dns=114.114.114.114
不知道可以:在本机上查看ip: 打开dos命令窗口 ,输入 ipconfig /all
4、在网络配置文件 /etc/sysconfig/network 中添加网关地址
NETWORKING=yes
HOSTNAME=yangni
GATEWAY=192.168.0.1 //添加网关地址
5、重启网络服务
sudo service network restart
6、不能上网:
6-1、如果能ping通网关,但是ping不同百度的话,可能是DNS没设置好,可以检查下配置文件:
cat /etc/resolv.conf
设置内容为:nameserver 8.8.8.8 nameserver 114.114.114.114
6-2、确保在网络配置文件 /etc/sysconfig/network 中添加了网关地址(设置ip的文件)
grep GATEWAY /etc/sysconfig/network-scripts/ifcfg*
#########################net模式#################################
直接关闭Linux nscd 缓存服务:
/etc/init.d/nscd stop
网关配置:/etc/sysconfig/network
host文件位置:/etc/hosts(IP地址到hostname的对应。访问系统名字可以找到本机ip) 192.68.1.11 message.xxx.com 格式:ip 系统名字
系统名字:(需要重启电脑生效) https://jingyan.baidu.com/article/574c52192a1d8d6c8d9dc1ce.html |
dns配置同上(仅主机模式)
#################
仅主机模式
#########################################-----------------------------------------------
7版本命令: ip: ifconfig (查看ip) (7版本以上) ip addr 查看ip service network restart 重启网络 防火墙: (7版本自带) systemctl stop firewalld 关闭防火墙(临时) systemctl start firewalld 启动防火墙 systemctl disable firewalld 禁用防火墙 systemctl enable firewalld 启用防火墙 systemctl status firewalld 查看状态 service iptables status (没有iptables)安装iptables防火墙 yum install iptables-services -y 1、永久性生效,重启后不会复原。 2、 即时生效,重启后复原 host文件位置:/etc/hosts查看计算机名:在终端输入hostname永久修改,要修改配置文件/etc/sysconfig/network修改hostname=需要改的名字
|
-------------------------------------------------------------
######克隆修改####################################################
######################################################################