Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how static IP in systemd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
pmam
l33t
l33t


Joined: 30 Dec 2013
Posts: 711

PostPosted: Wed Apr 02, 2014 8:06 am    Post subject: how static IP in systemd Reply with quote

Hi,

I am quite new in gentoo and just installed gnome/systemd.
I emerged NetworkManager.service and at the moment it is working in dhcp mode -
I prefer to switch to static IP - I do know how to do it in OpenRC but need your advise regarding systemd.
Back to top
View user's profile Send private message
Marlo
Veteran
Veteran


Joined: 26 Jul 2003
Posts: 1164

PostPosted: Wed Apr 02, 2014 10:10 am    Post subject: Reply with quote

try this:
/etc/systemd/system/static-network.service wrote:

[Unit]
Description=Static network service
After=local-fs.target
Documentation=man:ifconfig(8)
Documentation=man:route(8)

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/ifconfig enp5s0 192.168.1.2 broadcast 192.255.255.255 netmask 255.0.0.0 up
ExecStart=/bin/route add default gw 192.168.1.1 enp5s0

[Install]
WantedBy=multi-user.target


enp5s0 is my network cart. <use your own networknumbers>
_________________
Thks 4 ur attention, interest & support.
Back to top
View user's profile Send private message
pmam
l33t
l33t


Joined: 30 Dec 2013
Posts: 711

PostPosted: Wed Apr 02, 2014 12:39 pm    Post subject: Reply with quote

Marlo Hi,

As I noted in my post I am new in gentoo... :D
I understand that I should change to my network name card and to my IP address but -
please explain me what I should do with this text?

I enabled NetworkManager.service - Static IP is not part of it?

Thanks
Back to top
View user's profile Send private message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 209
Location: Haarlem, Netherlands

PostPosted: Sun Jul 20, 2014 1:57 pm    Post subject: Reply with quote

Might be a little late but better late then never.
First I don't know wether you could set-up a static network with networkmanager.
But it would be strange if it couldn't be done.

If you want the network always be the same then you do not have the need fore networkmanager.
You can then open a terminal and type this:
Code:

cd /etc/systemd/system
nano -w static-network.service

Now fill in the part of the other answer.
Then after your done type ctrl + o and ctrl + x.

then type:
Code:

chmod +x static-network.service
systemctl enable static-network.service
systemctl start static-network.service


And finaly to check if it works:
Code:

ifconfig


If you are not a root user you might have to use sudo or login as root.

Hope this answers your question.
Back to top
View user's profile Send private message
comprookie2000
Developer
Developer


Joined: 25 Jul 2004
Posts: 913
Location: Pompano Beach, Florida

PostPosted: Mon Jul 21, 2014 12:22 am    Post subject: Reply with quote

You should be able to set it up with nm-applet under gnome
settings => network => wired then click on the gear * bottom right => ipv4 => Addresses => Manual
_________________
http://dev.gentoo.org/~dabbott/
Back to top
View user's profile Send private message
pmam
l33t
l33t


Joined: 30 Dec 2013
Posts: 711

PostPosted: Mon Jul 21, 2014 7:27 am    Post subject: Reply with quote

Dear elmar283 & comprookie2000,

Quote:
Might be a little late but better late then never.

Yes, a little bit late :wink: However still helpful tips for others and for me for the next trying of systemd.
Due to some problems I had faced with systemd, I switched to Open-RC but at the moment reconsidering to try it again -
I quite liked Gnome/Systemd. Is Gentoo's systemd has improved lately?

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 209
Location: Haarlem, Netherlands

PostPosted: Mon Jul 21, 2014 12:26 pm    Post subject: Reply with quote

If you might want to try an network on systemd without NetworkManager, I just figured that out yesterday:
https://forums.gentoo.org/viewtopic-t-995866-highlight-systemd+wlp3s0.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum