Configuring the IP address for Linux

Source: Internet
Author: User

dhclient// automatically get IP (by DHCP )

ifconfig-a// viewing network card information

[Email protected] ~]# ifconfig-a

Eth0 Link encap:ethernet HWaddr 00:0c:29:47:df:59

inet addr:192.168.137.22 bcast:192.168.137.255 mask:255.255.255.0

Inet6 ADDR:FE80::20C:29FF:FE47:DF59/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:66 errors:0 dropped:0 overruns:0 frame:0

TX packets:79 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:8105 (7.9 KiB) TX bytes:9539 (9.3 KiB)

Interrupt:19 Base address:0x2000

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Inet6 addr::: 1/128 scope:host

Up LOOPBACK RUNNING mtu:65536 metric:1

RX packets:10 errors:0 dropped:0 overruns:0 frame:0

TX packets:10 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:688 (688.0 b) TX bytes:688 (688.0 b)

Manual Configuration IP Address

[[Email protected] ~] #vim/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0

hwaddr=00:0c:29:47:df:59

Type=ethernet

Uuid=240760af-14a7-4da5-8cb5-d1e08d2319f4

Onboot=yes// Boot from boot

Nm_controlled=yes

bootproto=static// Set IP address is static

ipaddr=192.168.137.22//IP Address

netmask=255.255.255.0// Network Mask

gateway=192.168.137.1// Gateway

dns1=8.8.8.8//dns

dns2=114.114.114.114

well configured IP address and then restart the network

[Email protected] ~]# service network restart

Shutting down interface Eth0:device State:3 (disconnected)

[OK]

Shutting down loopback interface: [OK]

Bringing up loopback interface: [OK]

Bringing up interface eth0:active connection state:activated

Active Connection path:/ORG/FREEDESKTOP/NETWORKMANAGER/ACTIVECONNECTION/1

[OK]

or restart a network card separately

[Email protected] ~]# Ifdown eth0

[Email protected] ~]# ifup eth0

This article is from the Linux Learning Notes blog, so be sure to keep this source http://9656134.blog.51cto.com/9646134/1675459

Configuring the IP address for 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.