wtorek, 22 listopada 2016

How to find ip adres on Centos OS?

How to get ip address of a Centos 7 / Redhat in bash (command line)?.
It's quite simple. There a few ways. Previously you could use ifconfig command.
Now you can't use ifconfig even you install net-tools.
So how to check your server ip?
- You can simply ping your hostname
cat /etc/hostname
ping "hostname from file" ;)
- Another way is to type "ip addr show"and you and you'll get your ip address :)

[root@bareos ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:b4:a9:7f brd ff:ff:ff:ff:ff:ff
    inet 192.168.200.13/24 brd 192.168.200.255 scope global ens32
       valid_lft forever preferred_lft forever
    inet6 fe80::250:56ff:feb4:a97f/64 scope link
       valid_lft forever preferred_lft forever
3: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:b4:1b:ff brd ff:ff:ff:ff:ff:ff
4: ens34: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:b4:f9:3d brd ff:ff:ff:ff:ff:ff