Linux Configuration network card IP address command and common network configuration commands

Source: Internet
Author: User

Ifconfig eth0 192.168.1.102 netmask 255.255.255.0//Add IP Address

Route add default GW 192.168.1.1//Add Gateway

Start in effect:

Vim/etc/sysconfig/network-scripts/ifcfg-eth0//(Some versions may not have vim this editor such as CentOS, you may replace with VI)

IPADDR=192.168.1.102//Add IP Address

netmask=255.255.255.0//Mask

gateway=192.168.1.1//Add Gateway

The final results are as follows:

Device=eth0

Bootproto=static

ipaddr=192.168.1.102

netmask=255.255.255.0

geteway=192.1 68.1.1

Onboot=yes

Type=ethernet

Note: Bootproto only can use the IP information set in static (static) mode

Modify DNS

Vim/etc/resolv.conf

Can be effective immediately after modification

Form

Join Nameserver= ***.***.***.***

Up to three, as a candidate after the previous failure

Modify Host Name

Immediate effect:

Hostname FC2

Start in effect:

Vim/etc/sysconfig/network

The form is as follows:

Networking=yes

hostname=rh-linux.fc.org

##########################################################

First, understand the traditional network configuration commands:

1. Configure and view network interface conditions using the Ifconfig command

Example 1: Configure eth0 IP and activate the device at the same time:

Ifconfig eth0 192.168.4.1 netmask 255.255.255.0 up

Example 2: Configure IP for the eth0 alias device eth0:1 and add routes

Ifconfig eth0:1 192.168.4.2

Route add–host 192.168.4.2 Dev eth0:1

Example 3: Activating (disabling) a device

Ifconfig eth0:1 up (down)

Example 4: View all (specified) network interface configurations

Ifconfig (eth0)

—————————

Related Article

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.