linux中网络的管理
2017-07-29 23:29
197 查看
1.ip基础知识
1.ipv42进制32位—–10进制
172.25.0.10/255.255.255.0
172.25.0.10:ip地址
255.255.255.0:子网掩码
子网掩码255位对应的ip位为网络位
子网掩码0对应的ip位为主机位
2.配置ip
<<图形化>>1.图形界面
nm-connection-editor
2.文本化图形
nmtui
<<命令>>
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
此处在真机中执行命令vim /etc/sysconfig/network-scripts/ifcfg-br0
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
5.dns
1.dnsdns是一台服务器
这太服务器提供了回答客户主机名和ip对应关系的功能
2.设定dns
vim /etc/resolv.conf
nameserver dns服务器ip
vim /etc/sysconfig/network-scripts/ifcfg-网卡配置文件
DNS1=dns服务器ip
3.本地解vim /etc/hosts主机名称
4.本地解析文件和dns读取的优先级调整
/etc/nsswitch.conf
38 #hosts: db files nisplus nis dns
39 hosts: files dns ##files代表本地解析文件,dns代表dns服务器,那个在前面那个优先
相关文章推荐
- Linux运维学习笔记之九:网络管理和磁盘管理
- Linux基础网络管理
- Linux任务调度及crontab用法详解、进程的介绍和管理、时间、网络状态信息、路由信息等
- RH253(Red Hat Linux)网络及安全管理课程
- linux 系统、文件、磁盘、网络配置管理,软件包
- 网络系统管理:Linux实训篇
- linux中的网络管理
- Linux 网络管理、软件包安装
- Linux基本命令篇 - 网络管理
- 中断及任务调度管理(linux网络协议栈笔记)
- Linux网络管理常用命令:net-tools VS iproute2
- Linux基础和网络管理上机试题 - imsoft.cnblogs
- Linux基本命令篇- 网络管理2
- Linux用户管理(九)Linux网络基础
- Linux系统--Linux网络管理与配置
- linux 网络管理 监测等相关的工具 ping 、traceroute、ss、netstat
- 基于 Linux 系统的Nagios网络管理模块的实现
- Linux学习日记 —— 6.3.1 RPM包管理-yum在线管理-IP地址配置和网络yum源
- Linux网络管理小结
- Linux网络管理之网络抓包