Linux Network

linux network
  file sharing occurs between --PC invention Ethernet
  LAN hardware address --MAC

  One: Physical layer
    HUB - Hub bus structure for data transmission in the form of a flooding
    broadcast domain / domain conflicts

  Story:
    In early networks, PC interoperability can only MAC address forwarding data; - Layer 2 forwarding the concept of
    bridge - switch - maintains a MAC address table

  Three:
    With the increase of network devices that require network more and more; this time, the communication of these devices is a document - had a logical address;
    IPV4, IPV6, IPX, AppleTalk, Novell, DEC - early logical address
    network interconnection - the route up!
    Router - a routing table

--------------------------------------------------------------------------------------------------------------------

  Four layers: the transport layer
    core task to have changed - Application Interworking
    application port:
      the TCP: Transmission Control Protocol
        common port: 20 is 21 is 22 is 23 is 80 443 110 25 53 is
      the UDP: protocol data unit
        common port: 67 68 69

  Application Layer:
    program application

  Access to network resources of a real process:
    1, the network resources of a PC - kernel space management
    2. Application Layer (interprocess communication)
      1, internal PC communication process - 1) parent and child communication 2) single signal communications
      2, PC process communication between - 1) rpc 2) socket socket (do separate application)


About Host command control networks:
  the ifcfg family command:
    ifconfig
      ifconfig displays the current interface up
      ifconfig lo0 | eth0
        -a
      ifconfig interface name IP address netmask mask [up | down]
      After the IP address configuration take effect immediately, but after the restart the card, they will restore
      ifconfig eth0 192.168.94.201 netmask 255.255.255.0 // automatically generated eth0: 0 sub-interface (label), del can be deleted

      ifconfig | grep -o --color = auto "\ ([0-9a-fA-F] \ {2 \}: \) \ {5 \} [0-9a-fA-F] \ {2 \}" // matches the MAC address

    route 查看以及添加路由
      route -n //-n不做解析

      添加路由
        1、添加默认路由(添加网关)
          route add default gw 192.168.94.2
        2、添加主机路由(去往一个固定的IP地址)
          route add -net 192.168.95.0 network 255.255.255.0 eth0
        3、添加路由网段
          route add -net 192.168.95.0 network 255.255.255.0 eth0
        路由类型: Flags -- U(up)、H(主机路由host)、G(网关路由gw)

      删除路由
        route del 指定路由删除


    netstat
      一般查看的内容
        -t tcp
        -n 不解析
        -a --tcp协议标记为(syn、ack、fin...)
        -l listen
        -e establish
        -u UDP
        -p pregrom以及pid 查看该链接建立/监听会话的程序/进程
      查看路由内容
        -r --route
      进行数据统计
        netstat -i //统计接口数据传输情况
        -v -e 查看扩展的内容


  ip家族命令:
    ip命令是比ifconfig更加新的命令,功能要比ifconfig更加强大
      ip [option] object {command | help} help可以查看object的用法
      object
        link
          add
          del
          set
            ip link set DEV {up | down} //控制端口的开关
            ip link set DEV {on|off}
            ip link set DEV dymic {on|off}
          show 查看端口情况
        addr
          add 默认可以添加备用地址
          replace change
          del 删除--只能删除一个地址
            ip addr del 192.168.94.200/24 dev eth0:0
          flush 指定一类地址同时删除
            ip addr flush dev eth //清空所有的地址
          show


        route
          add
            ip route add 192.168.95.0/24 via 192.168.94.2
            ip route add 192.168.95.95 dev eth0
          del
            ip route del 192.168.95.0/24
          flush
            ip route flush dev eth0 //删除所有有关eth0的路由,包括直连路由,不建议使用

      ss 查看套接字的工具
        ss [option] [filter]
        ss -tan //a --all t --tcp n --不做解析
          u udp
          w raw(没有有传输层头部数据包)
          -D file 将信息输入到文件,不显示在屏幕上
          -m 显示占用内存空间
          -p 和netstat -p,显示进程


        这些配置都是临时生效的,只要重启就没有了
  图形界面管理:
    yum install system-config-network-tui -y
      这个工具和setup一样,setup调用的tui的接口;
      进图形进行端口配置
    centos7
      nmtui

    在图形下配置IP地址,需要重启后生效

  配置文件:
    /etc/sysconfig/network-scripts/ifcfg-interface

    /etc/sysconfig/network-scripts/route
    /etc/udev/rules.d/70-persistent-net.rules

Guess you like

Origin www.cnblogs.com/4443056bdH/p/11431700.html