Wednesday, July 8, 2015

RHEL7 - Assinging IP address and Hostname

Tried to assign hostname and IP address for my centos 7 server, but it made me laugh.

By default it already has ip address through dncp and I had second interface and tried to assign new ip and plumb and brought it up, I got new IP.. Lol....

[root@localhost ~]# ifconfig -a
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:b5:3a:4a  txqueuelen 1000  (Ethernet)
        RX packets 865  bytes 86882 (84.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.10  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::20c:29ff:feb5:3a54  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:b5:3a:54  txqueuelen 1000  (Ethernet)
        RX packets 130  bytes 18025 (17.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 95  bytes 14812 (14.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 808  bytes 69786 (68.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 808  bytes 69786 (68.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# nmcli connection down eno16777736
Error: 'eno16777736' is not an active connection.
[root@localhost ~]# ethtool eno16777736
Settings for eno16777736:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: off (auto)
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes
[root@localhost ~]# nmcli connection modify eno16777736 ipv4.method manual
Error: Failed to modify connection 'eno16777736': (32) ipv4.addresses: this property cannot be empty for 'method=manual'

[root@localhost ~]# nmcli connection add ifname eno16777736 type ethernet ip4 192.168.10.245/24 gw4 192.168.10.1
Connection 'ethernet-eno16777736' (b066fe77-42c6-484d-9e07-ea46bb1b7b32) successfully added.

[root@localhost ~]# nmcli connection modify eno16777736 ipv4.dns 192.168.10.110
[root@localhost ~]# nmcli connection up eno16777736
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
[root@localhost ~]#
[root@localhost ~]# ifconfig -a
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.11  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::20c:29ff:feb5:3a4a  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:b5:3a:4a  txqueuelen 1000  (Ethernet)
        RX packets 1230  bytes 140171 (136.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 8716 (8.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.10  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::20c:29ff:feb5:3a54  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:b5:3a:54  txqueuelen 1000  (Ethernet)
        RX packets 1325  bytes 152268 (148.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 571  bytes 75569 (73.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 808  bytes 69786 (68.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 808  bytes 69786 (68.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# # hostnamectl set-hostname server7.expanor.local
[root@localhost ~]# hostname
server7.expanor.local
[root@localhost ~]#


No comments:

Post a Comment