Gentoo How to configure your network

Source: Internet
Author: User

Http://www.gentoo.org/doc/zh_cn/handbook/handbook-x86.xml?part=4&chap=1

1. Novice on the road

1.a. Novice on the road

Note: This article assumes that you have configured your kernel, including the module of your hardware, and you know the interface name of your hardware (this is the NIC). We also assume that you have set the eth0, of course it can be eth1, wlan0 and so on.

Note: This document requires that you are running a baselayout-1.11.11 or later version.

To start configuring your network card, you first need to tell the Gentoo RC system your network card. This can be done by creating a symbolic link to the Net.lo named Net.eth0 in the/ETC/INIT.D directory.

Code 1.1: Establish a symbolic connection Net.eth0 point to Net.lo

# cd/etc/init.d
# ln-s Net.lo net.eth0

Now Gentoo's RC system knows this interface. It also needs to know how to configure this interface. All network interfaces are set in the/etc/conf.d/net file. The following is a simple configuration that sets DHCP and static addresses:

Code 1.2: An example of a/etc/conf.d/net file

# DHCP
config_eth0= ("DHCP")

# static IP
config_eth0= ("192.168.0.7/24") with CIDR representation
routes_eth0= (" Default via 192.168.0.1 ")

# static IP config_eth0= in netmask form
(" 192.168.0.7 netmask 255.255.255.0 ")
routes _eth0= ("Default via 192.168.0.1")

Note: If you do not specify, DHCP is the default option.

Note: CIDR represents the level-free Internet domain route (classless interdomain Routing). Initially, the IPV4 address was categorized as A,b or Class C. The original classification system did not take into account the Internet is so popular, there will be the risk of running out of IP. CIDR allows an IP address to express multiple IP addresses. In addition to ending with a slash followed by a number, CIDR IP addresses are the same as regular IP addresses; for example: 192.168.0.0/16. CIDR is defined in RFC 1519.

Now that we've configured the interface, we can start and stop it with the following command

Code 1.3: Start and stop network scripts

#/etc/init.d/net.eth0 Start
#/etc/init.d/net.eth0 stop

Important: We recommend that you set the rc_verbose= "Yes" in the/etc/conf.d/rc file. This allows you to get more information about the failure when the network fails.

Now that you have successfully started and stopped your network interface, you may want to start it when the Gentoo is started. This is done: (The last "RC" command tells Gentoo to start a script that hasn't been started in the current runlevel)

Code 1.4: Configure the network interface to load it at boot time

# rc-update Add net.eth0 default
# RC

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.