CentOS commands for viewing IP addresses, modifying IP addresses on ports, and activating ports

Source: Internet
Author: User
You know that ipconfig is used to in windows, and it is a lot of trouble to view IP addresses in CentOS. The information collected today focuses on IP port problems: View IPifconfigeth0 & rarr; check the IP address, but the output information is more ifconfig | grep & #39; Bcast & #39; & rarr; the output information should be clear and the IP address should be modified.

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 = <你的ip>
    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

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.