Linux Network Properties Configuration

Source: Internet
Author: User
Tags aliases

    • Linux Network Properties Configuration
  • IP (Internet Protocol) Address: network number + host number
  • Ipv4:32bits
  • 8bits 8bits 8bits 8bits
  • 0-255
  • 0.0.0.0-255.255.255
  • IP Address Classification:
  • Class A:
  • The first paragraph is the network number, the latter three are the host number
  • Network number
  • 0 Fixed 000 0000-0 111 1111:
  • Number of networks: 1-127
  • Number of hosts per network: 2^24-2 (full 0, all 1)
  • Host all 0 represents the network itself address, all 1 means all host broadcast address address
  • Default Subnet Mask: 255.0.0.0
  • With the IP address bitwise "and" operation, so as to remove its network address;
  • 1.4.2.1/255.0.0.0=1.0.0.0
  • 1.4.2.1/255.255.0.0=1.4.0.0
  • Private network Address: 10.0.0.0/255.0.0.0
  • Class B:
  • The first two paragraphs are the network number, the latter two are the host number
  • Network number:
  • 10 00 0000-10 11 1111:128-191
  • Network number: 2^14
  • Number of hosts per network: 2^16-2
  • Default Subnet Mask: 255.255.0.0
  • Private network Address: 172.16.0.0-172.31.0.0 (16)
  • Class C
  • The first three paragraphs are the network number, the last segment is the host number
  • Network number:
  • 110 00000-110 11111:192-223
  • Network number: 2^21
  • Number of hosts per network: 2^8-2
  • Default Subnet Mask: 255.255.255.0
  • Class D: Multicast
  • 1110 0000-1110 1111:224-255
    • Ipv6:128bits
  • Router: Router
  • Send a packet from one device to another on a different network. The work is done by routers. Routers only care about the state of the network and determine the best path in the network, and the implementation of the route relies on the routing table in the router.
  • Route table Generation:
  • Statically specified
  • Dynamic Learning: RIP2,OSPF protocol
  • Destination Address: Next hop (nexthop)
  • Category of Destination address:
  • Host: Host Routing
  • Network: Network routing
  • 0.0.0.0/0.0.0.0 default route
  • When communicating, the digital ID of the process
  • 16bits:
  • 0-65535:1-65535
  • 1-1023: Fixed allocation, and only administrators have permission to enable;
  • 1024-4W: Semi-fixed
  • 4w+: temporary;
  • Only one process per port can be run at a time
  • IP addresses are used to identify the source and destination hosts and processes
  • MAC: Local communication: Range: Local LAN any Internet traffic must be switched to local
  • IP: Define communication host, source and target, range: Internet
  • Port: Define the process; scope; host
  • Network configuration:
  • The Linux host is involved in the network, and network-related settings need to be configured.
  • Host Name
  • Ip/netmask: Local Communication
  • Routing (Gateway): Default gateway
  • DNS server address: Host-name-based communication
  • The primary DNS service has its address
  • Alternate DNS server address
  • Third Backup DNS service its address
  • How to configure:
  • Statically specified:
  • Command:
  • Ifcfg
  • Ifconfig: Configure IP, Nermask
  • Route: Routing
  • Netstat: status and Statistics view
  • Configuration file
  • Iproute2:
  • IP OBjECT:
  • Addr: Address and mask;
  • Link: interface
  • Route: Routing
  • CONRTOS7:NM (NetworkManager)
  • NMCLI: command-line tools
  • Nmtul:text Window Tool
  • Dynamic allocation: Dependent on a DHCP service in the local network
  • DHCP:DYANMLC Host Configure Procotol
    • Command mode for network interfaces
    •     Traditional naming
    •    Ethernet: Eth[0-n], for example: eth0.eth1...
    •    PPP network: pppx [0,....] For example, Ppp0,ppp1 ...
    • predictable naming scheme (Contos):
    •   supports several different naming mechanisms:
    •       Fireware, topological structure
    •  1. If the index information provided by the firmware or BIOS-integrated device on the main board is available, it is named according to the secondary index, such as eno1,2 ....
    •  2. If the index information provided by the firmware or BIOS for the PCI-E expansion slot is available and predictable, it is named according to the secondary index, such as ens1,2:
    •  3. If the physical location information for the hardware interface is available,   is named according to this information, such as enp2s0 ....
    • 4 If the user displays the definition, it can also be named according to the MAC address, such as enx122161 bar E10 ....
    •   None of the above is available and is still named in the traditional way;
    • Linux Network configuration
    • Ifconfig
    • Ifconfig interface
    • Ifconfig-a: Displays all interfaces, including interface ports for the inative State;
    • command specifies:
    • Ifconfig eth1 ip/24 up add
    • Ifconfig Eth1-ptomisc Removal
    • Options
    • -Promisc
    • Immediate effect
    • Manage IPV6 Addresses
    • IP Add Addr/prefixien added
    • IP del addr/prefixien Delete
    • Route: Route view and Management
    • host route: Destination address is a single IP
    • network route:   Destination address is IP network
    • default route:   Target is any host, 0.0.0 .0/0.0.0.0
    •     View:
    •           Route-n
    •   add:
    •      route add [-net|host] target [netmask nm][GW GW] [DEV]LF
    •      route add-net 10.0.0.0/8  GW 192.168.10.1  dev eth1
    •      route  add  -net  0.0.0.0/0. 0.0.0 GW 192.168.10.1
    •      route add  default   GW 192.168.10.1
    •   Delete
    •      route del  -net 10.0.0.0/8  GW  192.168.10.1
    •      route del  default   Delete default gateway
    •  netsat:
    •   Show routes: Netstat-r
    •      -R: Show kernel routing table
    •      -n: Number format
    •   Show Network connections:
    •    netstat 
    •      -T:TCP related connections to the Protocol, The connection is in a state; FSM
    •      -U:UDP related connection  
    •      -w:raw socker RELATED LINKS
    •   & nbsp  -A All states
    •        -n: Displays IP and port in numeric format;
    •        -E: Extended format
    •        -P: Show related processes and PID
    • Common Combinations
    •    -tan    -uan  -tnl  -tual
    • Transport Layer protocol:
    •      TCP: Connection-oriented protocol: to establish a virtual link before communication begins, and to remove the connection after completion of the communication;
    •      UDP: no connection protocol; Send data message directly;
    • Display statistics for the interface:
    • Netstat
    • All interfaces
    • Netstat-i
    • Specify the interface:
    • Netstat-ieth1 (no spaces)
    • Ifup,ifdow:
    • To identify the interface and complete the configuration via the profile/etc/sysconfig/network-scripts/ifcfg-xxx
  • Configure host Name
  • Hostname
  • View: Hostanme
  • Configuration: hostname hostname
  • Currently valid only
  • Hostnamectl
  • Hostnamectl Status: Displays the current hostname information
  • Hostnamectl set-hostname: Sets the hostname. permanently valid;
  • Configuration file:/etc/sysconfig/network
  • DNS server points to
  • Configuration file:/etc/resolv.conf
  • How to test/etc/hostsnslookup/dig
  • Dig-t A FQDN
  • Iproute
  • Manage IP Addresses
  • Add IP
  • IP addr Add ifaddr dev IFCE
  • IP addr Add 192.168.1.1/24 dev eth0
  • Label NAME: Specify the label for additional add-on addresses
  • IP addr 10.1.1.10/8 dev eth0 label eth0:1
  • Broadcast address: Broadcast addresses, which are calculated automatically based on IP and netmask;
  • Global: Globally available
  • Link: Interface available
  • Host: Only available on this machine
  • IP Addr List: Displays the specified interface address
  • Add route
  • IP route add TYPE PREFIX via GW Dev IFACE src source_ip
  • IP route add 192.168.0.0/24 via 10.0.0.1 dev eth1 src 10.0.20.100
  • IP route Add default
  • Delete
  • IP route del TYPE PREFIX
  • IP Route del 192.168.0.0/24
  • IP Route list Lists routing tables
  • IP Route Flush 192/24 empties the specified route
  • Default gateway to unknown interface all go 2 interface
  • Clear all addresses of the indicated interfaces
  • IP addr Flsh Dev eth0
  • SS command
  • Options
  • -T:TCP Protocol RELATED LINKS
  • -U:UDP Protocol RELATED LINKS
  • -w:raw Socker RELATED LINKS
  • -A All States
  • -N: Displays IP and port in digital format;
  • -e: Extended format information
  • -P: Show related processes and PID
  • -M: Memory usage
  • -O: Timer information
  • Ss-tan ' (dport=:22 or sport =: 22) ' Indicates a filter port of 22
  • Configuration file:
  • Config file for Ip/netmask/gw/dns properties:/etc/sysconfig/network-scripts/ifcfg-iface: Interface Name
  • Interface properties can be defined by a number of parameters; Vim Text editor editing
  • Nmtui Centos7
  • Systme-config-network CENTOS6
  • Ifcfg-iface Configuration Parameters
  • Device: The name of the unit that corresponds to this profile
  • Onboot: Whether this interface is activated during system boot
  • UUID: Test Equipment unique indication
  • Bootproto: Use the SET protocol to configure interface properties when activating this interface, commonly used dhcp,bootp,none;
  • Type: interface types, common with Ethernet, Bridge
  • DNS1: The first DNS server points to;
  • DNS2: Alternate DNS servers point to;
  • Ipaddr:ip Address
  • Gateway: Default Gateways
  • NETMASK: Subnet mask, Cenots7:p Refix
  • Peerans: If the value of Bootproto is "DHCP" allows the DHCP server to assign a DNS server to the override local manually specified DNS server to point to, the default is allow;
  • Nm_controlled: Whether to use the NetworkManager service to control the interface
  • Networking Services: Network Neteorkmanager
  • Chekconfig--list View Network Service status
  • Manage network Services
  • After the configuration file is modified, the service needs to be restarted
  • Centos6:service NETWORK [stop|start|restart|] Close/Start/restart
  • Centos7:systmectl NETWORK [stop|start|restart|] service shutdown/Startup/restart
  • Two configurations are supported but not mixed
  • 1
  • One route entry per line
  • Taeget via GW
  • 2
  • One route entry per three lines
  • Addres=target
  • Netmask=mask
  • Gatway=nexthop
  • Configuring multiple addresses for an interface
  • In addition to IP addr, ifconfig or configuration files are available;
  • 1ifconfig Iface_label Ipaddr/netmask
  • iface_label:eth0:0,1 ...
  • 2, add the configuration file for aliases;
  • Device=iface_label
  • Bootproto: Online aliases do not support dynamic acquisition of addresses;
  • Static,none
  • The NIC of the alias can only be manually set by itself and cannot be retrieved dynamically

Linux Network Properties Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.