In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "Linux server network configuration", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Linux server network configuration" bar!
Prohibit ping
Sometimes, in order to protect the host, other machines are prohibited from ping the host. The Ping command uses the ICMP protocol, and as long as the ICMP protocol is disabled, the ping method cannot detect the host. The configuration file about the ICMP protocol is "/ proc/sys/net/ipv4/icmp_echo_ignore_all". If you write 1 to this file, you can disable ICMP and write 0 to turn on ICMP. This operation does not require a restart of the network service
1. Check ICMP. As you can see from the following result, ping is allowed by default.
[root@localhost ~] # cat / proc/sys/net/ipv4/icmp_echo_ignore_all
2. Prohibit ICMP
[root@localhost ~] # echo "1" > / proc/sys/net/ipv4/icmp_echo_ignore_all
[root@localhost ~] # cat / proc/sys/net/ipv4/icmp_echo_ignore_all
one
3. Enable ICMP
[root@localhost ~] # echo "0" > / proc/sys/net/ipv4/icmp_echo_ignore_all
[root@localhost ~] # cat / proc/sys/net/ipv4/icmp_echo_ignore_all
Disable ipv6
1. Disabling ipv6 is easy, just write "install ipv6 / bin/true" in the configuration file "/ etc/modprobe.d/disable-ipv6.conf", and then restart the system.
[root@localhost ~] # echo "install ipv6 / bin/true" > / etc/modprobe.d/disable-ipv6.conf
[root@localhost ~] # ifconfig
Eth0 Link encap:Ethernet HWaddr 08:00:27:14:33:57
Inet addr:192.168.0.108 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:30 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
Collisions:0 txqueuelen:1000
RX bytes:3891 (3.7KiB) TX bytes:2134 (2.0KiB)
2. If you want to enable ipv6, simply delete the configuration file.
Ps: the configuration file mentioned above does not exist. We will give it a name and load the configuration file in the "/ etc/modprobe.d" directory when the system is restarted.
Configure ip
1. Start the network card
1) Network profile / etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~] # gedit / etc/sysconfig/network-scripts/ifcfg-eth0
Name of DEVICE=eth0 network card
HWADDR=08:00:27:14:33:57 mac address
TYPE=Ethernet device Typ
UUID=b8b1216e-1570-4e0e-bb96-7666ddf0b707 unique ID
Whether the ONBOOT=no starts up or not
NM_CONTROLLED=yes
Use dhcp when BOOTPROTO=dhcp starts
2) modify the network card to boot
ONBOOT=yes boot up
3) restart the network service. After modifying the configuration file of the network card, only restart will take effect.
[root@localhost ~] # service network restart
By default, Centos uses the dhcp service and automatically assigns ip addresses
2. Configured fixed ip address
1) add ipaddr
IPADDR=192.168.0.250
2) add NETMASK
NETMASK=255.255.255.0
3) add GATEWAY
GATEWAY=192.168.0.1
4) add DNS
DNS1=119.29.29.29
5) restart network services
[root@localhost ~] # service network restart
Ps: in the above configuration, it is strictly case sensitive. After Dns is configured, you can see it in the / etc/resolv.conf file, as follows:
[root@localhost ~] # cat / etc/resolv.conf
# Generated by NetworkManager
Nameserver 119.29.29.29
3. Configure ip with graphical interface
Users can modify ip through a graphical interface, which avoids complex commands and is easier to configure.
1) enter the "setup" command at the terminal, pop up the following window, and select "Network configuration"
2) Select DNS configuration
3) eth0 is the first network card. You can configure its ip by selecting it.
4) cancel dhcp so that you can configure ip and dns
5) Select dhcp so that ip cannot be configured
6) No matter which way you choose, remember to save
Thank you for your reading, the above is the content of "Linux server network configuration", after the study of this article, I believe you have a deeper understanding of the Linux server network configuration, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.