Switch to static ip

Hi,

i would like to switch to a static ip. I used the rockstor ui to make the changes but after i submit the new static ip, i can’t connect anymore to the NAS, both with to old ip and the new static ip i’ve choosen. After a reboot of the NAS, rockstor still tells me the old ip on the last boot up screen. I logged-in as root and fired up ‘nmtui’. nmtui shows me the correct static ip and that it is activated. after a second reboot rockstor now tells me the new static ip on the last boot up screen, but unfortunately i still can’t connect to the rockstor ui with the static ip. Any hints?

Bert

Hi Bert,

Are your subnet and gateway configured properly in the static configuration? Can you post a cat of the network configs within the Rockstor node and your local network? Then I can look with you :-).

edit:
since you use nmtui (there is nothing wrong with that!), you might not know where to find the raw networking configuration. It’s here:

[root@~]# cat /etc/sysconfig/network-scripts/ifcfg-
ifcfg-eno1      ifcfg-eno2      ifcfg-eno3      ifcfg-eno4      ifcfg-enp2s0f0  ifcfg-enp2s0f1  ifcfg-lo

Just type your active NIC-name after ‘ifcfg’ and you are good to go.

Good luck!

Hi Luna,

and thank you for your help!
The cat of the network configs within the Rockstor node:

[root@medienserver ~]# cat /etc/sysconfig/network-scripts/ifcfg-Ethernet_connection_1
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME="Ethernet connection 1"
UUID=bd848e1d-9d17-42ea-af4b-29096f33c26e
DEVICE=enp1s0
ONBOOT=yes
IPADDR=192.168.0.4
PREFIX=32
GATEWAY=192.168.0.1
DNS1=192.168.0.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

This seems all correct. My local network is from
192.168.0.1 … 192.168.0.6

PS. Thank you for your hint in the edit, it was very helpful.

Bert

just type
ifconfig
and all will be clear :slight_smile:

Hi,

[root@medienserver ~]# ifconfig
-bash: ifconfig: command not found

Bert

@Tomasz_Kusmierz ifconfig actually is replaced by ‘ip’.

@Bert when you want to get the information Tomasz refers to, type ip a.

You say that your current network is from 192.168.0.1 - 192.168.0.6. Do you really mean the network or do you mean something like the DHCP server or the current used IP’s? Not many home users split their IP space this way, so just checking ;-).

Either way: are you sure the prefix is right? When you use the RFC1918 private address 192.168.0.0 you probably use a different prefix, like 24 or 16. If you really configured your network from 1 to 6, I think it should be /29 (or 255.255.255.248).

Gould you check your router configuration and see what the subnet mask for this particular network is?

1 Like

No it’s not:

[root@server ~]# ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
inet6 fe80::42:a8ff:fe31:5720 prefixlen 64 scopeid 0x20
ether 02:42:a8:31:57:20 txqueuelen 0 (Ethernet)
RX packets 3115440 bytes 563674274 (537.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3221199 bytes 3038499968 (2.8 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enp2s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.202 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::9a4b:e1ff:fe6c:b328 prefixlen 64 scopeid 0x20
ether 98:4b:e1:6c:b3:28 txqueuelen 1000 (Ethernet)
RX packets 95088267 bytes 84832157066 (79.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 197489240 bytes 286637473385 (266.9 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfbee0000-fbefffff

enp2s0f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 98:4b:e1:6c:b3:29 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
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
device memory 0xfbe80000-fbe9ffff

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

veth1c99ce6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::e456:bfff:fe96:f28 prefixlen 64 scopeid 0x20
ether e6:56:bf:96:0f:28 txqueuelen 0 (Ethernet)
RX packets 370 bytes 806370 (787.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 276049 bytes 32541704 (31.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

veth918a00b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::c67:b4ff:fe90:c1d9 prefixlen 64 scopeid 0x20
ether 0e:67:b4:90:c1:d9 txqueuelen 0 (Ethernet)
RX packets 518639 bytes 210682573 (200.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 574130 bytes 85557059 (81.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

vethed56f02: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::cb7:cbff:fea4:7ee8 prefixlen 64 scopeid 0x20
ether 0e:b7:cb:a4:7e:e8 txqueuelen 0 (Ethernet)
RX packets 8 bytes 648 (648.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 275344 bytes 32095456 (30.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

vethff66d9a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::4075:3bff:fe96:625c prefixlen 64 scopeid 0x20
ether 42:75:3b:96:62:5c txqueuelen 0 (Ethernet)
RX packets 52545 bytes 6757191 (6.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 325509 bytes 78090576 (74.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

and foremost, “ip” is a command that gives configuration of IPv4 stack, ifconfig gives configuration of interfaces … and those could be configured by IPv4 / IPv6 / IPX / ATM / FibreChannel etc etc etc

If you would pay attention to OP you would notice that prefix he uses is 32 - therefore it’s non configurable network for interface - hence I would like him to get ifconfig output (connect to physical console, not the web gui) because with “IPV4_FAILURE_FATAL=no” interface will never get configured even thou there is possibility that stack will suck in a specific IP address (it will just ignore mask and route resulting from it)

Thanks @Luna and @Tomasz_Kusmierz

@Luna
sorry for the confusion. i have a very simple home network
192.168.0.1 router
192.168.0.2 pc1
192.168.0.3 pc2
192.168.0.4 NAS

192.168.0.6 pc4
end and no 192.168.0.0
My subnet mask is 255.255.255.0

@Tomasz_Kusmierz


sorry for the picture, i don’t know an alternative simple way to provide the information.

and foremost, “ip” is a command that gives configuration of IPv4 stack, ifconfig gives configuration of interfaces …

In most cases, ifconfig isn’t needed at all. ip is more powerfull, complete, consistent and almost all distro’s and containerization templates come with it (which isn’t true for ifconfig, which is less common every year). And with good reason: ifconfig should be deprecated on all Linux distro’s that use modern networking since it’s known to behave inconsistently (or worse). Of course CentOS is supported for a very long time, so ifconfig won’t be gone anytime soon.

Some quotes you may find interesting:

… ifconfig is known to behave inadequately in modern network environments. They should be deprecated, but most distros still include them. Most network configuration systems make use of ifconfig and thus provide a limited feature set.

The command /bin/ip has been around for some time now. But people continue using the older command /sbin/ifconfig. Let’s be clear: ifconfig will not go away any time soon, but its newer version, ip, is more powerful and will eventually replace it.

Also, it’s not true that ip gives information about the IPv4 stack only, I don’t know where you read this? It is a replacement for almost everything ifconfig does (and a lot of other stuff too). I think there are disadvantages to both, some syntax is easier with the one, some syntax easier with the other etc. etc. But in the end iproute2 is the newer, more feature complete and in time the replacement of ifconfig, route etc.

1 Like

Hi Bert,

No problem! Why do you use /32 (255.255.255.255) on the interface? Your network seems to use /24 (255.255.255.0) right?

By the way, a tip about an alternative way for the picture: use SSH when you are not already doing this :slight_smile:. With SSH you can remote login to the Rockstor server and copy pase, scroll and stuff (from another PC!). On Windows, I would recommend PuTTY (for starters), on Linux or MacOS you can use the build-in one(s). I don’t know how good this guide is, but is seems to cover the basics pretty straight forward: https://mediatemple.net/community/products/dv/204404604/using-ssh-in-putty-

yeah … almost …

  1. you forgot about atm, ip can’t configure that so considering planet earth (which is exclusivelly operated by atm over any form of medium - even atm over fibre channel) ifconfig is not going anywhere
  2. Your quote are created by people that don’t understand that world extends beyond laptop talking IP to local router … show me where ip tool alows you to reconfigure interface into promiscuous mode and listen to any mac address on, after all, home network.
  3. ifconfig is for configuring devices, creating and destroying interface, passing data into kernel modules, talking ioctl into kernel … ip can’t do that

So: your ip command did not help here, ifconfig that is not supposed to exist saved the day, go 'brush up your ash" and don’t drive users into brick wall with misinformation about ifconfig being deprecated.

Don’t be apologetic mate, any picture will do. From your picture we see that since you’ve had a prefix of 32 - it resulted a mask of 255.255.255.255, which creates a network with LITERARLY 0 (zero) addresses allowed on it. This is why nobody can talk to you, your machine can’t answer back because it considers everybody else on different network.

To solve that: edit your config and replace prefix of 32 with 24. You can use “nano” or “vi”. After to avoid any problem wait 30 seconds after save. Call “sync” couple of times, and then call “reboot -fn”

Problem I see here is that this configuration is also stored in internal database of rockstor (correct me if wrong) and it can overwrite your config (at least it was last time I was looking into it)

Hi @Luna and @Tomasz_Kusmierz ,

THANK YOU! That was the trick. Changing in ‘nmtui’ from 192.168.0.4/32 to /24 and i can reach the rockstor server again with the static ip. The strange thing is, that i never actively put /32 in. I used the rockstor UI to switch from dhcp to static and i think rockstor self gave this /32 prefix.
Quoted from the explanation bubble in the network section of the rockstor ui of the ip address field:
"a usable static ip address( in CIDR notation) for your network. Eg. 192.168.1.10/24. If IP is provided without netmask bit count, e.g. 192.168.1.10 then it defaults to 192.168.1.10/32."
i think this was my mistake.

@Luna thanks for the hint to use ssh, but i even couldn’t connect the my rockstor NAS via ssh.

@Bert
In the past I was trying to solve few problems around not being able to set static IP without a default gateway … but I never spotted that. BIG THANKS !

I could say the same about you, most things you claim simply aren’t true. By the way, even the fricking official manual of ifconfig says it’s obsolete:

This program is obsolete! For replacement check ip addr and ip link.

Or another beautiful quote about the crappyness of ifconfig:

Given that we have the successor ip from the iproute2 package with the features (including newer things like policy routing), there is just no need to continue using ifconfig. Consider to be ridiculed at when posting traces of utilizing it.

Source: ifconfig sucks

Above that, your points are irrelevant within the context of this problem, and actually quite irrelevant for most networks. ip a and ifconfig (which didn’t work for Bert for some reason and is inadequate on large networks quite fast) would give exactly the same usefull information in this scenario, and in both cases it was clear the error was the /32 subnet (which was already clear because of the pasted config where I suspected the error would be, since /32 is the default fallback).

About your questions/statements: I would advise you to read the man page of iproute2, it might surprise you. Creating, destroying, prosmode (i.e. ip link set enp2s0f0 promisc on) and a lot of other things are rather easy and consistent with ip. In addition ifconfig is rather limited: no multi-path routing, rpdb, tap, tun, l2tp to name a few top of mind.

No worries if you like to use the old stuff, it still works in most scenarios and if your software or tools are build on it, it might not even be worth replacing/rewriting/refactoring it. But your arguments are simply flawed. Also, I don’t think it’s fair to say that “Your quote are created by people that don’t understand that world extends beyond laptop talking IP to local router”, since the authors of the software (and also some of the blogs) have put a lot of time and effort in a lot of different use cases (from small home till large country transcending networks). But of course you may think completely different about all of this :slight_smile:.

If you want to use ssh, I could help you troubleshoot :slight_smile:. I found to be able to use ssh is a very handy skill when managing servers. I don’t want to manage everything without anymore ;).

You could first enter systemctl status sshd to see what the status of the ssh server is. On my server it is active:

[root@~]# systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-03-04 21:34:15 CET; 6 days ago

When not active, you can use two commands to activate it:

systemctl start sshd
systemctl enable sshd

This might be a little bit confusing, so let me explain. ‘Start’ will start the proces, but will not start the servive on every reboot. ‘Enable’ will start the service on every reboot, so it will be active always. These commands will also provide you with some feedback when for example the service was already enabled.

When you suspect the openssh server isn’t installed on your server, then no worries. You can check this by running yum list installed | grep ssh. You should be on the lookout for the openssh-clients and openssh-server packages. When not available on your system, just install them with the CentOS packagemanager with yum -y install openssh-server openssh-clients.

I hope the solution is easy :blush:.

@Luna your example proves my point - you made a promiscuous interface that will only accept a IP traffic (arp and few other negotiation messages) … not an ipx traffic, “ip” command will not touch arcnet or atm … you simply still don’t get it, ip is created by IP fanboys that are not even aware of CAN networking used on vehicles … and there is more and more use cases for CAN / MOST / FlexRay and there are more computers inside a car than inside of a normal house.

Please configure a fibre-channel interface with storage array connected to it - no IP traffic :slight_smile: if you eliminate ifconfig amazon / google / fakebook ceases to exist within few seconds.

Also argument about countries is missed as well because countries route ATM not IP

I actually create it :* so I know how wrong you are from standpoint of experience :smiley: (not to mention close minded ip fan boys)