Routing and switching under Linux-part 1th

Source: Internet
Author: User
Tags dmesg

To execute a command in command-line mode:

This is the host's routing table, the host to access the Internet, you must set the legal IP parameters, including: Ip/netmask/gateway/route/dns IP and host name, etc.

Ip/netmask is used to confirm the host network, and to determine whether the target host and the host is in the same network;

Gateway is mainly used for communication between this host and other network hosts.

Route (route) establishes a path entry, divided into three types

1) Network routing: The Target is a web

2) Host routing: target is a host

3) Default route: target for all non-local networks, usually with the IP address of one of the network cards on the host's network as the gateway address. (default route in 172.18.0.1)

DNS servers primarily parse domain names, including:

1) Primary DNS server

2) Alternate DNS server

We know that the NIC integrated on the motherboard is responsible for the network communication between the host and the outside, under Linux can obtain the network card information through the DMESG command:

[[email protected] ~]# dmesg |grep-i eth
e1000 0000:02:01.0:eth0: (pci:66mhz:32-bit) 00:0c:29:0f:bd:4b
e1000 0000:02:01.0:eth0:intel (R) pro/1000 Network Connection
e1000 0000:02:02.0:eth1: (pci:66mhz:32-bit) 00:0c:29:0f:bd:55
e1000 0000:02:02.0:eth1:intel (R) pro/1000 Network Connection
e1000 0000:02:05.0:eth2: (pci:66mhz:32-bit) 00:50:56:2e:87:c6
e1000 0000:02:05.0:eth2:intel (R) pro/1000 Network Connection
e1000:eth0 NIC Link is up to + Mbps full Duplex, Flow control:none
e1000:eth1 NIC Link is up to $ Mbps full Duplex, Flow control:none

It can be seen from the above results that the NIC driver module modifies the/etc/udev/rules.d/70-persistent-net.rules file for e1000 (subsequent change of NIC name) and then modifies the/etc/sysconfig/network-scripts /ifcfg-eth* file; modprobe-r e1000 modprobe 1000 "), a total of 3 network cards, eth0/eth1/eth2

First, let's look at the ifconfig commands that are commonly used when querying host IP addresses.

Ifconfig "Tap this command individually to display the network card information that has been activated"

-A: Show all interfaces (with no activation)

Note that disabling or enabling a NIC can be accomplished with the command Ifup/down eth* or ifconfig eth* Up/down, but two commands are different:

Ifconfig commands for setting network parameters---

Ifup/down activating/Disabling a network adapter

Ifup/down is a script command that reads/etc/sysconfig/network-scripts/ifcfg-eth* files when executed, if: /ifcfg-eth* does not exist, the command will fail to execute! The ifconfig command has no such limit.

If you use Ifconfig to modify or set the network interface parameters, you cannot use Ifdown eth* mode to shut down. This is because Ifdown will parse the current network interface parameters with the file. If the configuration parameters of the/ifcfg-eth* are consistent and inconsistent, the operation will be discarded. So after modifying with ifconfig, you need to use ifconfig eth* down to close the interface.

Using the Ifup/down script to enable or disable a particular network interface is better than using the ifconfig command directly, because the script can carefully view and process all the parameters and related functions associated with a particular interface.

Routing and switching under Linux-part 1th

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.