网络的基本设定
来源:互联网 发布:数据分析与知识发现 编辑:程序博客网 时间:2024/06/05 20:54
*******************************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位为主机位
二.配置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
static|none **静态网络
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 *****设备
BOOTPROTO=static|none ****设备工作方式
ONBOOT=yes ***开启网络服务激活设备
NAME=eth0 ****网络接口名称
IPADDR=172.25.0.100 ****IP
三.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
四.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服务的配置
yum install dhcp -y
一.网络地址基础知识
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位为主机位
二.配置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 ****子网掩码
三.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
四.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服务的配置
yum install dhcp -y
阅读全文
0 0
- 网络的基本设定
- Java的基本设定!
- apache的基本设定
- mysql的基本设定
- MySQL的基本设定
- nfs的基本设定
- iscsi的基本设定
- pxe的基本设定
- iscsi的基本设定
- altium基本规则的设定
- altium基本规则的设定
- AD基本规则的设定
- dns的基本设定(一)
- Liunx学习笔记--基本网络设定(测试内容)
- Trixbox下SIP TRUNK的基本设定
- FreePbx中SIP TRUNK的基本设定
- Apache的安装部署与基本设定
- log4j的基本使用和参数设定
- jinfo
- Math && Program && Big-man
- oracle---添加空间索引
- 设计模式-9-桥接模式
- 青蛙跳台阶
- 网络的基本设定
- opencv3.2.0在vs2015,2017中的环境配置
- lua中关于取长度问题
- How to write a good design document for peer engineers (如何写一份给工程师看的技术文档)
- android NDK如何解决Please define the NDK_PROJECT_PATH variable to point to it
- 图解FTP的主动模式与被动模式以及客户端设置
- Android Things:外设I/O接口-GPIO
- 【C++】对象模型
- 三维迷宫