The Linux network card is turned on

Source: Internet
Author: User

One: File configuration network card when power on, automatically enable

First we use IP addr to view IP information

[Email protected] network-scripts]# IP Addr1: Lo: <LOOPBACK,UP,LOWER_UP> MTU16436qdisc noqueue State UNKNOWN Link/loopbackxx:xx:xx:xx:xx:xxBrdxx:xx:xx:xx:xx:xxinet127.0.0.1/8Scope host lo inet6::1/ -Scope host Valid_lft forever Preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU theQdisc Pfifo_fast State up Qlen +Link/etherxx: 0c: in: -: -: F1 BRD ff:ff:ff:ff:ff:ff inet6 fe80::20c:29ff:fe85:58f1/ -scope link Valid_lft forever Preferred_lft forever

You can see that the first one is the local loopback address, and the second is the NIC information we use. Generally no one is not inet and other information. Because the network card is not started by default.

[[Email Protected]hat2 ~]#cd/etc/sysconfig/network-scripts/#网络配置文件位置[[Email protected] network-scripts]# lsifcfg -eth0 (network card can be set)IFDOWN-ISDN ifup-aliases Ifup-plusb init.ipv6-Globalifcfg-lo ifdown-post IFUP-BNEP ifup-Post Net.hotplugifdown Ifdown-PPP Ifup-eth IFUP-PPP network-Functionsifdown-BNEP ifdown-routes ifup-ippp ifup-routes network-functions-Ipv6ifdown-eth ifdown-sit Ifup-ipv6 ifup-Sitifdown-IPPP Ifdown-tunnel ifup-isdn ifup-Tunnelifdown-ipv6 ifup Ifup-plip ifup-Wireless[[email protected] Network-scripts]#

View configuration Files

[Email protected] network-scripts]# vim ifcfg-eth0 DEVICE="eth0"Bootproto="DHCP"HWADDR="00:0c:29:85:58:f1"nm_controlled="Yes"onboot= "No" #默认是启动时不开启网卡, we can set this to YesTYPE="Ethernet"UUID="dd04bdab-73cc-41aa-94a4-1837bff7c726"

Then restart the network

Service Network restart

We found an IP.

[[Email protected] ~]# IP Addr1: Lo: <LOOPBACK,UP,LOWER_UP> MTU16436qdisc noqueue State UNKNOWN Link/loopbackxx:xx:xx:xx:xx:xxBrdxx:xx:xx:xx:xx:xxinet127.0.0.1/8Scope host lo inet6::1/ -Scope host Valid_lft forever Preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU theQdisc Pfifo_fast State up Qlen +Link/etherxx: 0c: in: -: -: F1 BRD ff:ff:ff:ff:ff:ff inet192.168.218.129/ -Brd192.168.218.255ScopeGlobaleth0 Inet6 fe80::20c:29ff:fe85:58f1/ -scope link Valid_lft forever preferred_lft forever[[email protected]~]#

The address obtained above is our own set in the Virtual network editor of the virtual machine.

II: Manual command to start and close ifup eth0 and Ifdown eth0
Ifup eth0    is the boot Nic Ifdown  eth0    is to turn off the NIC

Tweet: Ifconfig,ifup,ifdown

The Linux network card is turned on

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.