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 configure the network parameters of linux

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to configure the network parameters of linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to configure the network parameters of linux.

Main uses:

1. View the network interface settings: ifconfig-an or ifconfig network interface-a

2. Network configuration ifconfig network interface [add/del] ip address netmask subnet mask example: ifocnfig eth0 10.2.3.4 [netmask 255.255.255.0]

3. Activation / shutdown format of network interface: ifconfig network interface up/down

Configure dns

Create a / etc/resolv.conf file and write the dns server address in it

Configure Hostnam

Configure the / etc/sysconfig/network file and modify the hostname using hostname

Examples of use:

The copy code is as follows:

[root@twin0898 sysconfig] # cat network

Network networking/ network-scripts/

[root@twin0898 sysconfig] # cat network

Networking=yes

Gateway=125.39.149.1

Hostname=twin0898

Networking_ipv6=no

Common format:

1. Gateway to the network route add/delete-net destination network netmask mask gw gateway address [dev network interface]

2. Gateway to a single host route add/delete-host destination host gw gateway address [dev network interface]

3. Add default gateway: route add default gw gateway address check host routing table: route,netstat-nr

/ / the summary is as follows:

1. Network configuration check: ifconfig-a

2. Connectivity check: ping, traceroute

3. Routing table check: route or netstat-nr

4. Check the running status of dns client: nslookup

/ / examples of use are as follows

/ / ifconfig-a

The copy code is as follows:

Root@cinematest2:/usr/local/jdk# ifconfig-a

Eth0 link encap:ethernet hwaddr b8:ac:6f:38:10:c6

Inet addr:192.168.232.127 bcast:192.168.232.255 mask:255.255.255.0

Inet6 addr: fe80::baac:6fff:fe38:10c6/64 scope:link

Up broadcast running multicast mtu:1500 metric:1

Rx packets:42918159 errors:0 dropped:0 overruns:0 frame:0

Tx packets:40893832 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

Rx bytes:30644395811 (30.6 gb) tx bytes:30932951131 (30.9 gb)

Interrupt:16

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:917 errors:0 dropped:0 overruns:0 frame:0

Tx packets:917 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:0

Rx bytes:81417 (81.4 kb) tx bytes:81417 (81.4 kb)

/ / ping vip.jb51.net

The copy code is as follows:

Ping movie.kankan.co.sandai.net (114.80.189.60) 56 (84) bytes of data.

64 bytes from 114.80.189.60: icmp_seq=1 ttl=54 time=31.2 ms

64 bytes from 114.80.189.60: icmp_seq=2 ttl=54 time=29.9 ms

64 bytes from 114.80.189.60: icmp_seq=3 ttl=54 time=31.1 ms

64 bytes from 114.80.189.60: icmp_seq=4 ttl=54 time=30.5 ms

64 bytes from 114.80.189.60: icmp_seq=5 ttl=54 time=31.4 ms

64 bytes from 114.80.189.60: icmp_seq=6 ttl=54 time=32.6 ms

64 bytes from 114.80.189.60: icmp_seq=7 ttl=54 time=30.8 ms

64 bytes from 114.80.189.60: icmp_seq=8 ttl=54 time=30.9 ms

64 bytes from 114.80.189.60: icmp_seq=9 ttl=54 time=32.0 ms

64 bytes from 114.80.189.60: icmp_seq=10 ttl=54 time=31.3 ms

64 bytes from 114.80.189.60: icmp_seq=11 ttl=54 time=31.3 ms

64 bytes from 114.80.189.60: icmp_seq=12 ttl=54 time=30.3 ms

-movie.kankan.co.sandai.net ping statistics

12 packets transmitted, 12 received, 0 packet loss, time 11004ms

Rtt min/avg/max/mdev = 29.954 ms 31.148 max 32.608 max 0.704

/ / netstat-nr

The copy code is as follows:

Root@cinematest2:/usr/local/jdk# netstat-nr

Kernel ip routing table

Destination gateway genmask flags mss window irtt iface

0.0.0.0 192.168.232.2 0.0.0.0 ug 0 0 0 eth0

192.168.232.0 0.0.0.0 255.255.255.0 u 0 0 0 eth0

/ / nslookup vip.jb51.net

The copy code is as follows:

Root@cinematest2:/etc# nslookup vip.jb51.net

Server: 192.168.8.150

Address: 192.168.8.150#53

Non-authoritative answer:

Vip.jb51.net canonical name = movie.jb51.net.

Movie.jb51.net canonical name = movie.kankan.co.sandai.net.

Name: movie.kankan.co.sandai.net

Address: 114.80.189.60

Name: movie.kankan.co.sandai.net

Address: 119.147.41.209

At this point, I believe you have a deeper understanding of "how to configure the network parameters of linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report