首页 > 其他 > 详细

第十一章笔记 网络管理

时间:2017-01-22 08:08:25      阅读:216      评论:0      收藏:0      [点我收藏+]

####ip####
ipv4:互联网协议第4版
表示方式:2进制32位/10进制

例如:

192.168.10.13/255.255.255.0
192.168.10.13:ip地址
255.255.255.0:子网掩码
子网掩码255位对应的ip位为网络位
子网掩码0对应的ip位为主机位,若掩码为255.255.0.0,则只识别ip的前两段

255.255.255.0也可用24来表示,即2进制下24个1

###配置ip###
*图形化处理
1.图形界面
nm-connection-editor

 

技术分享

 


2.文本化图形
nmtui

技术分享

 


*命令设定ip
ifconfig 网卡 ip netmask    #临时设定,重启系统后恢复

nmcli connection add type ethernet con-name westos ifname eth0 autoconnect yes
nmcli connection add type ethernet con-name westos ifname eth0 ip4 ip/24
nmcli connection delete westos
nmcli connection show
nmcli connection down westos
nmcli connection up westos
nmcli connection modify "westos" ipv4.addresses newip/24
nmcli connection modify "westos" ipv4.method <auto|manual>
nmcli device connect eth0
nmcli device disconnect eth0
nmcli device show
nmcli device status



*配置文件
*dhcp                  #动态获取
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0              #接口使用设备
BOOTPROTO=dhcp          #网卡工作模式
ONBOOT=yes            #网络服务开启时自动激活
NAME=eth0              #网络接口名称
:wq
systemctl restart network



*static|none                 #静态网络
配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0                       #网卡设备
BOOTPROTO=static|none          #设备工作方式
ONBOOT=yes                      #开启网络服务激活设备
NAME=eth0                        #网络接口名称
IPADDR=172.25.0.100                #IP
NETNASK=255.255.255.0 | PREFIX=24 #子网掩码

(静态网络配置)
技术分享

 

 
###gateway 网关###

1.路由器
主要功能是用来作nat(地址转换)的
dnat    目的地地址转换
snat    源地址转换

2.网关
路由器上和自己处在同一个网段的那个ip(例如192.168.1.1)

3.设定网关
systemctl stop     NetwrokManager
配置文件:/etc/sysconfig/network                #全局网关
配置方法:GATEWAY=网关ip

 

技术分享

 


vim /etc/sysconfig/network-scripts/ifcfg-网卡配置文件 #网卡接口网关
GATEWAY=网关ip

systemctl restart netwrok              #重启服务

route -n                              #查询网关

技术分享




###dns###
1.dns
dns是一台服务器,提供了回答客户主机名和ip对应关系的功能

2.设定dns
配置文件:/etc/resolv.conf
配置方法:nameserver dns服务器ip

技术分享

 



配置文件:/etc/sysconfig/network-scripts/ifcfg-网卡配置文件(例如ifcfg-eth0)
配置方法:DNS1=dns服务器ip

3.本地解析文件

配置文件:vim /etc/hosts
配置方法:ip    主机名称

 

技术分享

 



4.本地解析文件和dns读取的优先级调整
配置文件:/etc/nsswitch.conf
 38 #hosts:     db files nisplus nis dns
 39 hosts:      files dns              #files代表本地解析文件,dns代表dns服务器,在前的优先
技术分享
 












第十一章笔记 网络管理

原文:http://www.cnblogs.com/puer633/p/6339308.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!