Linux基础学习——unit11
来源:互联网 发布:mysql数据库查看 编辑:程序博客网 时间:2024/06/06 00:09
11.管理网络
##1.ip基础知识
1.ipv4
2进制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
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.dns
dns是一台服务器
这太服务器提供了回答客户主机名和ip对应关系的功能
2.设定dns
vim /etc/resolv.conf
nameserver dns服务器ip
vim /etc/sysconfig/network-scripts/ifcfg-网卡配置文件
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服务器,那个在前面那个优先
5.dhcp服务的配置
- Linux基础学习——unit11
- Linux学习篇之~unit11
- Linux学习篇之~unit11练习
- Linux学习篇第二章之~unit11 系统恢复技术
- linux初学 unit11
- linux初学 unit11 练习
- unit11
- unit11
- unit11
- unit11
- Unit11
- Linux Unit11--系统中的文件传输
- linux ip的配置以及网关(unit11)
- 新手入门之——Linux学习基础
- 学习笔记_linux——linux基础
- 零基础学习Linux——ls
- 零基础学习Linux——ls
- linux基础——epoll学习笔记
- struts1+json的应用
- 缓存淘汰算法系列之2 --- LFU
- 网络通信之点播
- 勿忘初衷,方得始终
- 【JAVA程序】寻找最小生成树的欧拉路径,即一笔画问题
- Linux基础学习——unit11
- 意志力与习惯
- MS Bing Translate API安全机制变化后的全新调用方式
- 优化临时表使用,SQL语句性能提升100倍
- 设定目标
- 冒泡、选择、插入排序算法小总结
- This application has requested the Runtime to terminate it in an unusual way
- 线程阶段性总结——APM,ThreadPool,Task,TaskScheduler ,CancellationTokenSource
- 缓存淘汰算法系列之3 --- FIFO类