You are not logged in.

#1 2019-10-10 14:31:27

anselm
Member
Registered: 2017-11-21
Posts: 49

Network configuration with commands ifconfig and ip

On my VPS I always have to issue these commands - through VNC -, to get the network working:

ifconfig ens3 xx.xxx.xx.xxx/23 
ip r a default via XX.XXX.XX.X

The small x-es are for the IP address of the VPS, the capital X-es are for the router IP address, as far as I know, because the second command likely translates to its full form as:

ip route address default via xx.xxx.xx.x

After issuing these two commands I am able to connect to the VPS with SSH too, besides VNC, and networking is usable, then I am able to use ping, curl, wget, etc.
But after I restart the machine, these settings are always lost.
What config file should I edit, or which services should I start (DHCP ?)  to make these settings permanent?

Last edited by anselm (2019-10-10 14:32:33)

Offline

#2 2019-10-10 16:47:21

levi
Moderator
From: Yorkshire, UK
Registered: 2018-06-16
Posts: 728

Re: Network configuration with commands ifconfig and ip

Do you have to use those on top of the standard Arch way of getting online, namely the netctl scripts, or are you rolling your own solution there?  You don't seem to be obtaining an IP address via DHCPclient so unless you're using static addressing, I'd assume something's getting the machine basically connected to begin with.


Architecture: pentium4, Testing repos: Yes, Hardware: EeePC 901+2GB RAM+OS half on the SD card.

Offline

#3 2019-10-10 17:41:33

anselm
Member
Registered: 2017-11-21
Posts: 49

Re: Network configuration with commands ifconfig and ip

Standard way of course.

Offline

#4 2019-10-10 18:08:52

levi
Moderator
From: Yorkshire, UK
Registered: 2018-06-16
Posts: 728

Re: Network configuration with commands ifconfig and ip

Okay, and do you require this to happen without touching, for remote initial connections, or could we leave it to happen only when you log in?  The latter could be achieved in your .bashrc or somewhere, but getting it to happen automatically on powerup I think requires you to write a systemd unit file, and thus far my experiments at that have failed so I can't help there.


Architecture: pentium4, Testing repos: Yes, Hardware: EeePC 901+2GB RAM+OS half on the SD card.

Offline

#5 2019-10-10 19:56:30

deep42thought
Administrator
From: Jena, Germany
Registered: 2017-06-17
Posts: 505

Re: Network configuration with commands ifconfig and ip

anselm wrote:

Standard way of course.

What do you mean by that? Have you created and enabled some netctl profile? Have you configured some other network manager (systemd-networkd, ...)?

I suggest taking a look at netctl (either static or dhcp - depending on what you prefer). When either of that does not work, come back here with some log entries or other more specific problems :-)

In case you really just want to issue those two commands on startup, then have a look at systemd.service (man page) to run these commands on boot.

regards,
deep42thought

Offline

#6 2019-10-10 23:22:54

anselm
Member
Registered: 2017-11-21
Posts: 49

Re: Network configuration with commands ifconfig and ip

I see. I thought there is a configuration file, eg. in /etc which can be edited for this purpose.

Offline

#7 2019-10-11 05:43:01

levi
Moderator
From: Yorkshire, UK
Registered: 2018-06-16
Posts: 728

Re: Network configuration with commands ifconfig and ip

All the settings for netctl are in /etc/netctl, yes.


Architecture: pentium4, Testing repos: Yes, Hardware: EeePC 901+2GB RAM+OS half on the SD card.

Offline

#8 2019-10-11 06:17:10

deep42thought
Administrator
From: Jena, Germany
Registered: 2017-06-17
Posts: 505

Re: Network configuration with commands ifconfig and ip

have a look at upstream's great wiki smile

Offline

Board footer

Powered by FluxBB