Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the ip address of Network Card in linux system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Method 1: use the ifconfig command to configure the ip address of the network card

This command is usually used for temporary testing, and when the computer starts, the configuration of the ip address will automatically fail.

The specific usage is as follows:

Ipconfig ethx ipadd netmask x.x.x.x

The x in ethx represents the fast Ethernet card, the default first block is 0.ipadd represents the ip address, and x.x.x..x is the subnet mask.

For example, the ip address configured for the network card eth0 is 192.168.1.1 with a subnet mask of 255.255.255.0.

As shown in the following figure:

Note: the ip address configured by this method will expire after the computer restarts!

Method 2: use the neat command

Neat command = configure ip address under redhat-config-network drawing

Double-click the part under the picture that draws a red line

After double-clicking the underlined section, the following figure appears: configure the relevant information according to the requirements

Double-click ok to complete the configuration. Restart the service after configuration, and check the configuration ip address

Method 3: use the netconfig command

After entering netconfig, the following figure will appear. Click the yes button.

Ok exits after relevant configuration

Note: the ip address configured by this method will remain valid after the computer is restarted!

Method 4:

1. Take effect in time and expire after restart: add IP address to ifconfig eth0 192.168.1.102 netmask 255.255.255.0

Route add default gw 192.168.1.1 add a gateway in the same IP segment as the IP address added above.

Those that are still effective after restart: modify the file directly

Startup takes effect: vim / etc/sysconfig/network-scripts/ifcfg-eth0

IPADDR=192.168.1.102 / / add IP address

NETMASK=255.255.255.0 / / mask

GATEWAY=192.168.1.1 / / add Gateway

2. Modify hostname

Effective immediately: hostname fc2

Startup takes effect: vim / etc/sysconfig/network

The form is as follows: NETWORKING=yes HOSTNAME=rh-linux.fc.org

Traditional network configuration commands:

These are the details of the method of setting the ip address of the network card under linux. Please pay attention to other related articles for more.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report