首页 > 编程知识 正文

linux 查看网卡,linux防火墙关闭和开启命令

时间:2023-05-05 04:42:09 阅读:247315 作者:3515

重启命令

1、reboot
2、shutdown -r now 立刻重启(root用户使用)
3、shutdown -r 10 过10分钟自动重启(root用户使用)
4、shutdown -r 20:35 在时间为20:35时候重启(root用户使用)
如果是通过shutdown命令设置重启的话,可以用shutdown -c命令取消重启

关机命令

1、halt 立刻关机
2、poweroff 立刻关机
3、shutdown -h now 立刻关机(root用户使用)
4、shutdown -h 10 10分钟后自动关机

如果是通过shutdown命令设置关机的话,可以用shutdown -c命令取消重启

查看当前使用的网卡

watch cat /proc/net/dev

看下哪踏实的唇膏的流量变化大一般就是哪踏实的唇膏是在线使用的

重启网卡方法

(1)全部重启

重启网卡使设定生效:sudo /etc/init.d/networking restart

(2)单个网卡重启

关闭网卡 ifdown eth0

开启网卡 ifup eth0

禁用网卡

vi  /etc/sysconfig/network-scripts/ifcfg-eth1

onboot=NO

修改IP

查看网卡信息: ifconfig

(1)动态

设定一个网卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0

重启网卡使设定生效:sudo /etc/init.d/networking restart

(2)静态

编辑文件 /etc/network/interfaces

sudo vi /etc/network/interfaces

并用下面的行来替换有关eth0的行:

# The primary network interface  

auto eth0  

iface eth0 inet static  

address 192.168.2.1  

gateway 192.168.2.254  

netmask 255.255.255.0  

#network 192.168.2.0  

#broadcast 192.168.2.255 

将eth0的IP分配方式修改为静态分配(static)后,为其制定IP、网关、子网掩码等信息。

将上面的Ubuntu IP地址等信息换成你自己就可以了。

用下面的命令使网络设置生效:

sudo /etc/init.d/networking restart 

(3)其它

用ubuntu的系统——>系统管理——>网络的网络设置

操作防火墙(service方式)

查看防火墙状态: service iptables status

开启防火墙:service iptables start

关闭防火墙:service iptables stop

Session共享怎么实现详解docker pull 下来的镜像都存到了哪里openFeign

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。