您好,欢迎来到外链网!
当前位置:外链网 » 站长资讯 » 专业问答 » 文章详细 订阅RssFeed

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

来源:互联网 浏览:67次 时间:2023-04-08
重启命令

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

87716306