You are not logged in.
Pages: 1
Hi,
my internet provider give me 3 IP addresses, the first pc that start get the first, and so on
when I was using rc.conf it was easy to set a static ip to one of the pc active on my network
now I have systemd and the network works fine, but I do not know how to set a fix ip to it.
i'm browing around and i found out that i have to modify few files, that i did, but it still taking the worng IP when it reboot:
/etc/conf.d/network
interface=eth0
address=10.40.50.95
netmask=255.255.248.0
broadcast=10.40.55.255
gateway=10.40.48.1
/etc/systemd/system/network.service
[Unit]
Description=Static IP Connectivity
Wants=network.target
Before=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/ip link set dev ${interface} up
#ExecStart=/usr/sbin/wpa_supplicant -B -i ${interface} -c /etc/wpa_supplicant.conf # Remove this for wired connections
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down
[Install]
WantedBy=multi-user.target
also
systemctl report:
......
lvmetad.service loaded active running LVM2 metadata daemon
network.service loaded active exited Static IP Connectivity
NetworkManager.service loaded active running Network Manager
nmbd.service loaded active running Samba NetBIOS name server
......
i'm not sure why I have the network.service that in exited status
can you help me to fix the IP? what is missing?
Offline
It is unit type oneshot so it has done its job and have exited. It is as it should be.
You have set RemainAfterExit so it will remain and not stopping unless user responds.
I see you have networkmanager running. What do you use it for? Dos it use static ip?
I have the same setup myself and it works as it should. Systemd 197 rename interfaces so
look at your ip l (shortform for ip link) to find your interface and ip a to see if ip address is assigned to interface.
edit: correct typo
Last edited by ron9 (2013-02-12 22:51:29)
lenovo w500 - huawei matebook 14 | archlinux | swaywm | foot | falkon
Offline
I've been told that it's better to use netcfg. For a static address, copy /etc/network.d/examples/ethernet-static into /etc/network.d/ (and rename it if you want), and then change the parameters in there. The example file is missing a NETMASK line, so add the line
NETMASK=24
(or whatever your netmask is). Lastly, enable the network by typing
systemctl enable netcfg@ethernet-static
The netcfg wiki explains everything.
The reason that netcfg is better is because it plays nice with other system services, such as network file mounts (NFS or CIFS), while the method above does not.
P.S. As ron9 said above, your ethernet adapter name probably won't be "eth0". Type "ip link" to find out what it is, and then modify your ethernet-static file accordingly.
Last edited by hawaiicharles (2013-02-13 00:59:50)
Offline
I can also recommend using Netcfg instead, makes it easier to create multiple profiles aswell if you've got more advanced setups with VLANs etc.
I've been told that it's better to use netcfg. For a static address, copy /etc/network.d/examples/ethernet-static into /etc/network.d/ (and rename it if you want), and then change the parameters in there. The example file is missing a NETMASK line, so add the line
NETMASK=24
(or whatever your netmask is). Lastly, enable the network by typing
systemctl enable netcfg@ethernet-static
The netcfg wiki explains everything.The reason that netcfg is better is because it plays nice with other system services, such as network file mounts (NFS or CIFS), while the method above does not.
P.S. As ron9 said above, your ethernet adapter name probably won't be "eth0". Type "ip link" to find out what it is, and then modify your ethernet-static file accordingly.
Hurricane Electric Certified IPv6 Sage
CPU: Core i7-2600 @ 4.0Ghz | RAM: 16GB (4x4GB) | GFX: AMD Radeon R9 290 4096MB VRAM | HDD: 1x 120GB SATA3 Corsair SSD (~500MB/s RW), 1x SATA2 250GB, 1x SATA2 320GB, 1x 180GB SATA3 Intel SSD
*EDIT* Replaced Nvidia GTX 570 for a AMD Radeon R9 290, and added an extra SSD 180GB
Offline
Hi thanks for your answers
why do I use NetworkManager? I do not know, when I moved to systemd, it had a name that attracted me (it's not a good answer I know )
the results of the 2 commands you asked me
[root@artemide ~]# ip l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 14:da:e9:93:d8:59 brd ff:ff:ff:ff:ff:ff
[root@artemide ~]# ip a
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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 14:da:e9:93:d8:59 brd ff:ff:ff:ff:ff:ff
inet 10.40.50.94/21 brd 10.40.55.255 scope global eth0
inet6 fe80::16da:e9ff:fe93:d859/64 scope link
valid_lft forever preferred_lft forever
the address 10.40.50.94 is the one that it get dinamically at boot and that I want to make it static with 10.40.50.95
here is my old rc.conf file
interface="eth0"
address=10.40.50.95
netmask=255.255.248.0
broadcast=
gateway=10.40.48.1
for me it's ok to install and use netcfg, but what can I do for make sure it will be the one it's on and how can I uninstall the network.manager one?
thanks
Last edited by miky76 (2013-02-13 21:48:18)
Offline
for me it's ok to install and use netcfg, but what can I do for make sure it will be the one it's on and how can I uninstall the network.manager one?
If you don't want networkmanager, uninstall it (pacman -R networkmanager)
Then make sure no dhcp service is enabled (neither dhcpcd.service nor dhcpcd@eth0.service)
Install netcfg (If you use the testing repo I'd recommend netctl), create your profiles and enable them.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
You have to then after configuring your netcfg profiles enable it with systemd: systemctl enable netcfg@<interface>.
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline
I've installed netcfg but when I try to associate the profile it tells me network unreachable
what i did:
I've copied the file "ethernet-static" from the example folder, and I've put it in /etc/network.d
I've modified it in this way:
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='10.40.50.95'
#ROUTES=('192.168.0.0/24 via 192.168.1.2')
GATEWAY='10.40.48.1'
DNS=('8.8.8.8') #google dns
than i type:
systemctl stop dhcpcd@eth0.service
netcfg mynetwork_file
result
:: mynetwork_file up
RTNETLINK answers: Network is unreachable
> Adding gateway 10.40.48.1 failed
can you help me with this?
thanks
Last edited by miky76 (2013-02-21 21:01:11)
Offline
You might want to also consider netctl, as it is slated to be netcfg's replacement with better systemd integration.
I laugh, yet the joke is on me
Offline
I've installed netcfg but when I try to associate the profile it tells me network unreachable
what i did:
I've copied the file "ethernet-static" from the example folder, and I've put it in /etc/network.d
I've modified it in this way:
CONNECTION='ethernet' DESCRIPTION='A basic static ethernet connection using iproute' INTERFACE='eth0' IP='static' ADDR='10.40.50.95' #ROUTES=('192.168.0.0/24 via 192.168.1.2') GATEWAY='10.40.48.1' DNS=('8.8.8.8')
than i type:#google dns
systemctl stop dhcpcd@eth0.service netcfg mynetwork_file
result
:: mynetwork_file up RTNETLINK answers: Network is unreachable > Adding gateway 10.40.48.1 failed
can you help me with this?
thanks
Your netmask would have to be 255.255.0.0, (oops, you have 255.255.248.0), you may have to explicitly set this in the config file.
and with systemctl you would just start it with systemctl start/enable netcfg@mynetwork_file when you're sure everything is working.
Last edited by nomorewindows (2013-02-21 01:29:53)
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline
I've installed netcfg but when I try to associate the profile it tells me network unreachable
what i did:
I've copied the file "ethernet-static" from the example folder, and I've put it in /etc/network.d
I've modified it in this way:
CONNECTION='ethernet' DESCRIPTION='A basic static ethernet connection using iproute' INTERFACE='eth0' IP='static' ADDR='10.40.50.95' #ROUTES=('192.168.0.0/24 via 192.168.1.2') GATEWAY='10.40.48.1' DNS=('8.8.8.8')
than i type:#google dns
systemctl stop dhcpcd@eth0.service netcfg mynetwork_file
result
:: mynetwork_file up RTNETLINK answers: Network is unreachable > Adding gateway 10.40.48.1 failed
can you help me with this?
thanks
I don't know why, but the example file is missing a NETMASK entry. You have to add it manually, and you can use either of 2 formats:
NETMASK=255.255.248.0
- or -
NETMASK=21
It seems to work OK without a NETMASK entry if you're on a 24-bit subnet, but for anything else, you need the entry.
Offline
Well, I am sure it works fine without the NETMASK as long as it a Classful IP subnet, not just /24.
Class A: 1.0.0.0-126.255.255.255/8
Class B: 128.0.0.0-191.255.255.255/16
Class C: 192.0.0.0-223.255.255.255/24
Last edited by hunterthomson (2013-02-21 03:46:11)
OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec
Offline
Thanks to All,
i've added the netmask to the mynetwork_file and doing this
systemctl stop dhcpcd@eth0.service
netcfg mynetwork_file
the result is network up [DONE]
I've added in /etc/conf.d/netcfg the line
NETWORKS=(mynetwork_file)
and started the dhcp
systemctl stop dhcpcd@eth0.service
systemctl disable NetworkManager
during reboot the network configuration fail, bcos it's still looking for NetworkManager and netcfg fail too
running systemctl the result is:
.........
dhcpcd@eth0.service loaded failed failed dhcpcd on eth0
........
netcfg.service loaded failed failed Netcfg multi-profile daemon
network.service loaded active exited Static IP Connectivity
.......
I enabled again NetworkManager for use the network...
Offline
this maybe can be useful
[root@artemide ~]# systemctl status netcfg
netcfg.service - Netcfg multi-profile daemon
Loaded: loaded (/usr/lib/systemd/system/netcfg.service; enabled)
Active: failed (Result: exit-code) since Thu 2013-02-21 22:47:22 CET; 3min 9s ago
Main PID: 282 (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/netcfg.service
Feb 21 22:47:18 artemide systemd[1]: Starting Netcfg multi-profile daemon...
Feb 21 22:47:22 artemide netcfg-daemon[282]: :: mik_network up RTNETLINK answers: File exists
Feb 21 22:47:22 artemide netcfg-daemon[282]: Could not configure interface
Feb 21 22:47:22 artemide netcfg-daemon[282]: [fail]
Feb 21 22:47:22 artemide systemd[1]: netcfg.service: main process exited, code=exited, status=1/FAILURE
Feb 21 22:47:22 artemide systemd[1]: Failed to start Netcfg multi-profile daemon.
Feb 21 22:47:22 artemide systemd[1]: Unit netcfg.service entered failed state
[root@artemide ~]# ip addr
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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 14:da:e9:93:d8:59 brd ff:ff:ff:ff:ff:ff
inet 10.40.50.94/21 brd 10.40.55.255 scope global eth0
inet6 fe80::16da:e9ff:fe93:d859/64 scope link
valid_lft forever preferred_lft forever
Last edited by miky76 (2013-02-21 21:54:01)
Offline
Pages: 1