Network management of Linux

Source: Internet
Author: User

Linux NIC configuration file:/etc/sysconfig/network-scripts/ifcf-xxx

Device: Which of the devices this profile applies to, this option is a required parameter and needs to be configured correctly.

HWADDR: The MAC address of the corresponding device must match the MAC address of the relevant NIC. The default is not modified.

Bootproto: The address configuration protocol used when activating this device, common DHCP, static, none, BOOTP, options that must be configured.

onboot: The option that must be configured if this device is activated at system boot time.

Type: interface types; common Ethernet, Bridge; options that must be configured

NM_CONTROLLED:NM is a shorthand for NetworkManager; the NIC accepts NM control; CentOS6 is recommended as "no"

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 to use DHCP DNS

Here is a reference NIC configuration

[Email protected] ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0device=eth0bootproto=dhcphwaddr=00:0c:29:4e:f0 : 1aipv6init=nonm_controlled=yesonboot=yestype=ethernetuserctl=nopeerdns=yes

Linux routing configuration file:/etc/sysconfig/network-scripts/route-xxx

1. Network segment via Gateway

192.168.0.0/24 via 192.168.0.1

192.168.1.0/24 via 192.168.0.1

2. Define one route per three lines

Address#=target

Netmask#=mask

Gateway#=gw

address1=192.168.0.0

netmask1=255.255.255.0

gateway1=192.168.0.1

Command line network management tools

1.ip

IP [OPTIONS] OBJECT {COMMAND | help} #OBJECT can be {link | addr | route}

IP link Show displays all network hardware information

IP link Set Dev interface up|down switch card

IP addr Display all network hardware information

IP addr Add ip/mask Dev interface string NIC configuration information

Such as IP addr add 192.168.0.0/24 dev eth1

IP route show shows routing information

IP route add ip/mask via GW Dev interface

such as IP route add 192.168.0.0/24 via 192.168.0.1 dev eth0

If you add a default gateway: IP route add default via 172.16.0.1 dev eth0

IP route add ip/mask dev IFACE string src source_ip

2.ifconfig

Ifconfig [Interface]

Ifconfig-a displaying all network hardware information

Ifconfig inferface up|down Switch card

Ifconfig interface [Aftype] options | Address ...

Ifconfig interface Ip/mask

such as ifconfig eth0 10.0.0.1/24

ifconfig interface IP netmask MASK

such as ifconfig eth0 10.0.0.1 netmask 255.255.255.0

3.route

ROUTE-N Display Host Routing information

route add [-net|-host] target [netmask Nm] [GW GW] [[Dev] If] Add route
Target: 192.168.1.3 Gateway: 172.16.0.1

Route add-host 192.168.1.3 GW 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.1 Dev eth0

Route add-net 192.168.0.0/24 GW 172.16.0.1 Dev eth0

Default route, Gateway: 172.16.0.1

Route add-net 0.0.0.0 netmask 0.0.0.0 GW 172.16.0.1

route add default GW 172.16.0.1

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

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-net 192.168.0.0 netmask 255.255.255.0

NMCLI [OPTIONS] OBJECT {COMMAND | help}

Device-show and manage network interfaces

Connection-start, stop, and manage network connections

NMCLI connection Modify IFACE [+|-]setting.property value

Setting.property:

Ipv4.addresses

Ipv4.gateway

Ipv4.dns1

Ipv4.method

Manual


Network management of Linux

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.