View the IP address in centos, modify the IP address on the port, and enable the port to take effect.

Source: Internet
Author: User

You know, you get used to ipconfig in windows, and it is a lot of trouble to view IP addresses in centos;

The information collected today focuses on IP port problems:

    1. View IP
      Ifconfig eth0 → view the IP address, but the output information is more
      Ifconfig | grep 'bcast' → the output information should be much clearer.
    2. Modify IP address and take effect
      Edit/etc/sysconfig/network-scripts/ifcfg-eth0 and follow the settings below
      Device = eth0
      Bootproto = static
      Hwaddr =
      Onboot = Yes
      Type = Ethernet
      Ipaddr = <your IP address>
      Netmask = 255.255.255.0
      The MAC address can be viewed using the ifconfig eth0 command.
      After setting, restart the network service:Service Network restart
    3. After the centos system is installed, only port 22 is enabled by default. to open other ports, open the required ports.

VI/etc/sysconfig/iptables

Then add the JavaCode
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 3001-J accept
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 3001-J accept

Finally, the centos system needs to restart the service Java code.
/Sbin/service iptables restart
/Sbin/service iptables restart

Check whether Java code is enabled on the port

/Sbin/iptables-l-N

This operation is required to connect to the server using the mysql client, open port 3306, and configure nginx. This obstacle is no longer available now. Let's continue ......


You know, you get used to ipconfig in windows, and it is a lot of trouble to view IP addresses in centos;

The information collected today focuses on IP port problems:

    1. View IP
      Ifconfig eth0 → view the IP address, but the output information is more
      Ifconfig | grep 'bcast' → the output information should be much clearer.
    2. Modify IP address and take effect
      Edit/etc/sysconfig/network-scripts/ifcfg-eth0 and follow the settings below
      Device = eth0
      Bootproto = static
      Hwaddr =
      Onboot = Yes
      Type = Ethernet
      Ipaddr = <your IP address>
      Netmask = 255.255.255.0
      The MAC address can be viewed using the ifconfig eth0 command.
      After setting, restart the network service:Service Network restart
    3. After the centos system is installed, only port 22 is enabled by default. to open other ports, open the required ports.

VI/etc/sysconfig/iptables

Then add the Java code to the centos system.
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 3001-J accept
-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 3001-J accept

Finally, the centos system needs to restart the service Java code.
/Sbin/service iptables restart
/Sbin/service iptables restart

Check whether Java code is enabled on the port

/Sbin/iptables-l-N

This operation is required to connect to the server using the mysql client, open port 3306, and configure nginx. This obstacle is no longer available now. Let's continue ......

Related Article

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.