In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to configure network interface in ifconfig in Fedora". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to configure network interface in ifconfig in Fedora".
1. Fedora ifconfig check the status of the network interface Fedora ifconfig if it does not receive any parameters, it will output the current network interface:
[root@localhost ~] # Fedora ifconfig eth0 Link encap:Ethernet HWaddr 00:C0:9F:94:78:0E inet addr:192.168.1.88 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::2c0:9fff:fe94:780e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:850 errors:0 dropped:0 overruns:0 frame:0 TX packets:628 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen: 1000 RX bytes:369135 (360.4 KiB) TX bytes:75945 (74.1 KiB) Interrupt:10 Base address:0x3000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: 1thumb 128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:57 errors:0 dropped:0 overruns:0 frame:0 TX packets:57 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:8121 ( 7.9 KiB) TX bytes:8121 (7.9 KiB) Note:
Eth0 means * block network card, where HWaddr represents the physical address of the network card. You can see that the current physical address (MAC address) of this network card is 00:C0:9F:94:78:0E; inet addr is used to represent the IP address of the network card, and the IP address of this network card is 192.168.1.88, broadcast address, Bcast:192.168.1.255, mask address Mask:255.255.255.0.
Lo is the loopback address of the host, which is generally used to test a network program, but does not want users of the local area network or external network to view it, so it can only run and view the network interface used on this host. For example, assign the HTTPD server to the bad address and type 127.0.0.1 in the browser to see your WEB site. But only you can see, other hosts or users of the local area network do not know.
If you want to know all the network interfaces of the host, use the following command: [root@localhost ~] # Fedora ifconfig-a
If you want to view a port, such as the status of eth0, you can use the following method: [root@localhost ~] # Fedora ifconfig eth0
2. Fedora ifconfig configure network interface
Fedora ifconfig can be used to configure the IP address, mask, gateway, physical address of the network interface; it is worth mentioning that Fedora ifconfig is used to specify the IP address for the network card, which is only used to debug the network, and will not change the configuration file of the system about the network card.
If you want to fix the IP address of the network interface, there are three ways: the first is to modify the IP address through the special tools for each release and version; the second is to modify the configuration file of the network interface directly; the third is to modify the specific file and add the Fedora ifconfig instruction to specify the IP address of the network card, for example, in redhat or Fedora, write the name of Fedora ifconfig into the / etc/rc.d/rc.local file.
Fedora ifconfig method of configuring network port: the method of Fedora ifconfig tool configuring network interface is achieved through the parameters of instructions. We only talk about the most commonly used parameters: Fedora ifconfig network port IP address hw MAC address netmask mask address broadcast broadcast address [up/down] * example 1: for example, we use Fedora ifconfig to debug the address of the eth0 network card.
[root@localhost ~] # Fedora ifconfig eth0 down [root@localhost ~] # Fedora ifconfig eth0 192.168.1.99 broadcast 192.168.1.255 netmask 255.255.255.0 [root@localhost ~] # Fedora ifconfig eth0 up [root@localhost ~] # Fedora ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00 root@localhost 11 inet addr:192.168.1.99 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU: 1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0b) TX bytes:0 (0.0b) Interrupt:11 Base address:0x3400
Notes:
* Line: Fedora ifconfig eth0 down means to DOWN eth0 if it is active. This command is equivalent to the second line of ifdown eth0;: configure the IP address, broadcast address, and netmask of eth0 with Fedora ifconfig; the third line: activate eth0; with Fedora ifconfig eth0 up; this command is equivalent to line 4 of ifup eth0: use Fedora ifconfig eth0 to view the status of eth0.
Of course, you can also activate the Nic directly while instructing the IP address, network mask and broadcast address, adding the up parameter. For example, the following example:
[root@localhost ~] # Fedora ifconfig eth0 192.168.1.99 broadcast 192.168.1.255 netmask 255.255.255.0 up [root@localhost ~] # Fedora ifconfig eth0 down [root@localhost] # Fedora ifconfig eth0 192.168.1.99 broadcast 192.168.1.255 netmask 255.255.255.0 [root@localhost ~] # Fedora ifconfig eth0 up [root@localhost ~] # Fedora ifconfig eth0
* example 2: in this example, we should learn to set the physical address (MAC address) of the network card as well as the network IP address.
For example, we set the IP address, network mask, broadcast address, physical address of the network card eth2 and activate it.
[root@localhost ~] # Fedora ifconfig eth2 192.168.1.252 hw ether hw ether 1100VlV 1100VlV11 netmask 255.255.255.0 broadcast 192.168.1.255 up or [root@localhost] # Fedora ifconfig eth2 hw ether 00VOV 1100VlV 1122 [root@localhost] # Fedora ifconfig eth2 192.168.1.252 netmask 255.255.255.255.0 broadcast 192.168.1.255 up
Hw is followed by network interface type. Ether means Ethernet. It also supports ax2***RCnet, netrom and so on. For more information, please see man Fedora ifconfig.
3. Configure the virtual network interface with Fedora ifconfig
Sometimes we need to configure virtual network interfaces to meet different needs. For example, if we use different IP addresses to set up and run multiple HTTPD servers, we need to use virtual addresses; this eliminates the need for the same IP address. If you set up two HTTPD servers, you should specify the port number.
A virtual network interface refers to specifying multiple IP addresses for a network interface. Virtual interfaces are eth0:0, eth0:1, eth0:2. Eth2N . Of course, you specify multiple IP addresses for eth2, that is, eth2:0, eth2:1, eth2:2. and so on.
In fact, using Fedora ifconfig to configure multiple IP addresses for a network card, using the use of Fedora ifconfig mentioned earlier, this is relatively simple. Look at the following example:
[root@localhost ~] # Fedora ifconfig eth2:0 192.168.1.251 hw ether hw ether 1100VlV 1100VIED 1100VIED 1133 netmask 255.255.255.0 broadcast 192.168.1.255 up or [root@localhost ~] # Fedora ifconfig eth2 hw ether 00VOV 1100hw ether 1133 [root@localhost ~] # Fedora ifconfig eth2 192.168.1.251 netmask 255.255.255.0 broadcast 192.168.1.255 up
Note: when specified, each virtual network card should be assigned a different physical address. On Redhat/Fedora or a system similar to Redhat/Fedora, you can put the configured network IP address, broadcast address, mask address, physical address, and active network interface in one sentence at the same time, and write it into / etc/rc.d/rc.local. For example, the following example
Fedora ifconfig eth2:0 192.168.1.250 hw ether 00:11:00:00:11:44 netmask 255.255.255.0 broadcast 192.168.1.255 up
Fedora ifconfig eth2:1 192.168.1.249 hw ether 00:11:00:00:11:55 netmask 255.255.255.0 broadcast 192.168.1.255 up
The above is all the contents of the article "how to configure the network interface in ifconfig in Fedora". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.