linux运维-网络管理

uint11  管理网络
###1.ip基础知识###
1.ipv4
  2进制32位-----10进制


  172.25.0.10/255.255.255.0
          ip /
子网掩码

###2.配置
ip###
<<图形化
>>
1.图形界面


nm-connection-editor


2.文本化图形
nmtui


3.命令
ifconfig 网卡 ip netmask    ##临时设定

 



nmcli connection add type ethernet con-name linux(自己设定的ip名字) ifname eth0 autoconnect yes
nmcli connection add type ethernet con-name linux ifname eth0 ip4 ip/24
nmcli connection delete linux
nmcli connection show 
nmcli connection down linux
nmcli connection up linux


 

nmcli connection modify linux ipv4.addresses newip/24
nmcli connection modify linux ipv4.method <auto|manual>
(修改完之后一定要sytemctl restart NekworkManager和systenctl restart network,在用ifconfig查看才有修改后的效果)


nmcli device connect eth0
nmcli device disconnect eth0
nmcli device show
nmcli device status


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


static|none ##静态网络

vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0          ##
设备
BOOTPROTO=static|none        ##设备工作方式
ONBOOT=yes           ##开启网络服务激活设备
NAME=eth0            ##网络接口名称
IPADDR=172.25.0.100       ##IP
NETMASK=255.255.255.0 | PREFIX=24 ##
子网掩码

 



####3.gateway
网关####

1.路由器

主要功能是用来作nat的
dnat    目的地地址转换
snat    源地址转换

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

3.设定网关

systemctl stop  NetwrokManager
vim /etc/sysconfig/network  ##
全局网关
GATEWAY=网关ip


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

systemctl restart netwrok

route -n            ##查询网关

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0   (
网关)172.25.0.254    0.0.0.0         UG   0      0        0 eth0
172.25.0.0      0.0.0.0         255.255.255.0   U    0      0        0 eth0



####4.dns####
dns是一台服务器

这台服务器提供了回答客户主机名和ip对应关系的功能

1.
设定dns
vim /etc/resolv.conf
nameserver dns服务器
ip


vim /etc/sysconfig/network-scripts/ifcfg-网卡配置文件DNS1=dns服务器ip


2.本地解析文件vim /etc/hosts
ip 
主机名称


3.
本地解析文件和dns读取的优先级调整
/etc/nsswitch.conf
 39 hosts:      files dns       ##files
代表本地解析文件,dns代表dns服务器,哪个在前面

 
5.dhcp
服务的配置















 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值