honey

iproute2命令及centos7下网络配置

 linux的ip命令和ifconfig类似,但前者功能更强大,并旨在取代后者。使用ip命令,只需一个命令,你就能很轻松地执行一些网络管理任务。ifconfig是net-tools中已被废弃使用的一个命令,许多年前就已经没有维护了。iproute2套件里提供了许多增强功能的命令,ip命令即是其中之一。

这里写图片描述

  • 添加路由 ip route add default via 192.168.1.1
  • 查看路由 ip route show
  • 添加ip地址 ip addr 192.168.1.100/24 dev eno16xx
  • 删除ip地址 ip addr 192.168.1.100/24 dev eno16xx
  • 查看网络统计数据 ip -s link
  • 查看特定网络统计数据 ip -s link ls lo
  • 查看局域网的设备的MAC地址 ip neighbour
  • 查看netlink消息 ip monitor all
  • 激活和停止网络接口 ip link set ppp0 down up

Centos7网络配置

ip地址设置 /etc/sysconfig/network-script/ifcfg-dev
BOOTPROTO=static
NAME=eno16777736
ONBOOT=yes
IPADDR=192.168.117.128
NETMASK=255.255.255.0
GATEWAY=192.168.117.2
DNS1=192.168.117.2

域名地址配置
cat /etc/resolv.conf
nameserver 192.168.117.2

重启网络服务:
service network restart

systemctl restart network
systemctl status network

其他:
systemctl stop postfix
systemctl stop avahi-daemon
systemctl disable postfix
systemctl disable avahi-daemon
systemctl list-unit-files 查看正在运行服务的状态报告
systemctl start httpd.service 启动服务
systemctl stop httpd.service 关闭服务
systemctl restart httpd.service 重启服务
systemctl reload httpd.service 重新加载服务
systemctl disable httpd.service 开机不启动
systemctl enable httpd.service 开机启动
systemctl status httpd.service 查看服务运行状态
systemctl show httpd.service 显示服务或任务的属性
systemctl list-dependencies httpd.service 检查服务依赖关系
systemctl is-enabled httpd.service 检查服务是否开机启动及级别
systemctl -H 192.168.117.128 start httpd.service 启动192.168.117.128机器上的httpd服务

启动防火墙
systemctl start firewalld.service

停止防火墙
systemctl stop firewalld.service

禁止防火墙开机启动
systemctl disable firewalld.service

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值