Linux Network configuration

Source: Internet
Author: User

    • Routing Management Commands

View: Route-n

Add: Route add

Route add [-net|-host] target [netmask NM][GW GW] [[Dev] If]

Target: 192.168.1.3 Gateway: 172.16.0.1~]# Route add-host 192.168.1.3GW 172.16.0.1 Dev eth0

Target: 192.168.0.0 Gateway: 172.16.0.1~]# Route add-net 192.168.0.0 netmask 255.255.255.0 GW 172.16.0.1dev eth0

~] #route add-net 192.168.0.0/24 GW 172.16.0.1 Dev eth0

Default routing, Gateway: 172.16.0.1~]# Route add-net0.0.0.0 netmask 0.0.0.0 GW 172.16.0.1

~] #route Add default GW 172.16.0.1

Delete: Route del

Route del [-net|-host]target [GW GW] [netmask Nm] [[Dev] If]

Target: 192.168.1.3 Gateway: 172.16.0.1~] #route del-host 192.168.1.3

Target: 192.168.0.0 Gateway: 172.16.0.1~]# Route del-net192.168.0.0 netmask 255.255.255.0

    • DNS server Specifies

/etc/resolv.conf

Nameserverdns_server_ip1

Nameserverdns_server_ip2

Nameserverdns_server_ip3

Positive solution: Fqdn-->ip

#dig-T A FQDN

#host-T A FQDN

Inverse solution: Ip-->fqdn

#dig-X IP

#host-T PTR IP

    • Netstat

netstat [option]

-T:TCP protocol Related

-U:UDP protocol Related

-w:raw Socket Related

-L: In listening state

-A: all States

-N: Displays the IP and port numerically;

-E: Extended format

-P: Show related processes and PID

Common combinations:-tan,-uan,-TNL,-UNL

    • IP command

IP [OPTIONS] OBJECT {COMMAND | help}

IP Address-protocol Address Management

IP Addr {add | del} ifaddr dev STRING

[Label label]: Indicates the NIC alias when adding an address

[Scope {Global|link|host}]: Indicates scope

Global: Globally available;

Link: only links are available;

Host: the machine is available;

[Broadcast address]: Specify broadcast addresses

IP address show-look at protocol addresses

[Dev DEVICE]

[Label PATTERN]

[Primary and secondary]

IP Address Flush-flush protocol addresses

Use format with show

IP route-routing Table Management

IP route add

Add route: IP route add TARGET via GW dev IFACE src source_ip

TARGET:

Host Routing: IP

Network routing: Network/mask

Add Gateway: IP route add defalt via GW Dev IFACE

IP route Delete

Delete route: IP route del TARGET

IP Route Show

IP Route Flush

[Dev IFACE]

[Via PREFIX]

    • SS command

COMMAND:SS [OPTION] ... [FILTER]

-T:TCP protocol Related

-U:UDP protocol Related

-W: Bare Socket related

-x:unix Sock Related

-l:listen State of connection

-A: All

-N: Number format

-P: Related programs and PID

-E: Extended information

-M: Memory usage

-O: Timer information

    • Network-related configuration files

IP, MASK, GW, DNS-related configuration files:/etc/sysconfig/network-scripts/ifcfg-iface

Routing-related configuration files:/etc/sysconfig/network-scripts/route-iface

Device: Devices to which this profile applies;

HWADDR: The MAC address of the corresponding device;

Bootproto: The address configuration protocol used when activating this device, commonly used DHCP, static, none, BOOTP;

NM_CONTROLLED:NM is the abbreviation of NetworkManager, whether the NIC accepts NM control, CentOS6 is recommended as "no";

Onboot: Whether this device is activated at system boot time;

Type: interface types; common Ethernet, Bridge;

UUID: The unique identification of the device;

IPADDR: Specify the IP address;

NETMASK: Subnet mask;

Gateway: Default gateways;

DNS1: The first DNS server points to;

DNS2: The second DNS server points to;

Userctl: Whether the ordinary user can control the device;

Peerdns: If the value of Bootproto is "DHCP", whether the DHCPServer assigned DNS server is allowed to direct the information to the/etc/resolv.conf file;

This article is from the "Qinnengbuzhuo" blog, make sure to keep this source http://echoroot.blog.51cto.com/11804540/1923093

Linux Network 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.