如何centos7查看ip(地址)命令?

09-15

很多人都不知道centos是什么意思,以下小编会先介绍一下centos的意思
一、CentOS是什么意思

CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同,在于CentOS并不包含封闭源代码软件。

其次小编找到了五种方法,可供大家参考
方法一:
可以使用在终端下使用ifconfig命令查看ip信息

centos中的配置文件一般在/etc/sysconfig/network-script/ifcfg-eth0文件中;通过配置该配置文件,可以自动进行一个网络的设置,包括IPADDR,gateway,netmask,DNS1和DNS2等等;
如果想直接进行网络临时配置可以使用以下命令:

#ifconfig eth0 192.XXX.XXX.XXX
#route add default gw XXX.XXX.XXX.XXX

方法二:

[***@localhost ~]$ ifconfig eth0
eth0 Link encap:Ethernet
inet addr:192.168.91.132 Bcast:192.168.91.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feb3:45b3/64 Scope如何centos7查看ip(地址)命令?
ink
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46481 errors:0 dropped:0 overruns:0 frame:0
TX packets:32811 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:52759994 (50.3 MiB) TX bytes:2879378 (2.7 MiB)
Interrupt:19 Base address:0x2024
方法三:
[cj@localhost ~]$ ifconfig|grep 'Bcast'

inet addr:192.168.91.132 Bcast:192.168.91.255 Mask:255.255.255.0

方法四:
centos系统查看本机IP地址,输入 ifconfig -a查看

centos查询上网公网IP输入 curl ifconfig.me 命令即可查看

centos查询上网网关IP,tracepath www.baidu.com

方法五:
centos7查看IP地址:ip addr show eth0。
设置IP地址:ip addr add 192.168.1.1/24 dev eth0。
删除IP地址:ip addr del 192.168.1.1 dev eth0。
CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同,在于CentOS并不包含封闭源代码软件。