I am new to opensuse, but have worked a lot with debian & ubuntu but can’t find how to do this in opensuse.
I want to my opensuse system to specify a static IP for the box. in other distros, I’d go to /etc/sysconfig/netwwork and there would be a file ifcfg-eth0 with a parameter IPADDR=‘xxxx.xxxx.xxxx.xxxx’ and BOOTPROTO that would be set to STATIC.
I can’t find a similar config file in opensuse…Can someone tell me how to do this?/where the config file is located/named?
If I change the ip address to static, do I need to touch the default routes and nameserver spec? I want to ensure t hat it will still reach out and touch the router which is 192.168.1.1
YaST > Network > Network devices. You will find there places to not use Network Manger, but wicked. And to not use DHCP and places to fill in the IP address, Netmask, default router and DNS server(s).
I would not recoomend to touch the files using the CLI, except when you exactly know what you are doing.
You may not have realized this before,
One of the unique things about openSUSE is that we have GUI tools that do configuration (and other tasks) which can only be done by command line in other distros.
The main place to find these tools is in YAST.
This allows you to configure with less chance of typo error and will often guide you through the configuration, thereby standardizing and ensuring your configuration is complete.
YAST should also lower the bar for your migration from another distro to openSUSE… You won’t have to necessarily learn distro-specific differences configuring things in openSUSE, you only need to fill in the forms and save.
There is also a new set of command line tools which provide functionality similar to YAST if you prefer to use the command line rather than the GUI tools.
Thank you for the advice…I did try yast -> Network before making the post and got a message saying devices are controlled by network manager - cannot make changes (so something similar). So I figured it was blocked (with good reason).
Poked around a bit and found ‘wicked service’…so what the heck is that???
Anyway, I have been working/developing on unix systems since unix v6…I know my way around the CL and prefer to do things in this manner…what better way to learn the structure of the OS? but, I do understand the value of knowing exactly what one is doing…since I set up servers, I usually configure it headless…don’t need a GUI sucking up resources.
SO, any further specifics on wicked and, the correct files and locations to configure a static IP address would be appreciated…
TYVM
J
The Configuration Files are stored in /etc/sysconfig/network, ifcfg-network-interface-name), routes, see the template.
Also /etc/hosts, /etc/hostname, /etc/resolv.conf
OK, cool…ifup ~= wicked, got it. and ifup/dn/status works in the CL…
So, using YAST, selecting wicked, NetworkDevices -> NetworkSettings I changed network adapter (wlp2s0) to 192.168.1.50, and also the ethernet controller (enpls0), changed host name(linux), hit OK, yast created the appropriate files in /etc/sysconfig/network…I checked them and BOOTPROTO is STATIC with the IPADDR I specified in yast…
Rebooted obensuse, router…no wireless network connection…hmmmmm (didnt try wired port)…
Went back into YaST, changed manager from wicked to Network manager…saved…
Rebooted opensuse, router…
checked router device table and see that the opensuse box is 192.168.1.19, NOT 1.50…
checked host linux…yep…1.50…
Any suggestions why it was assigned 1.19 and not 1.50? did I forget to do something in YaST?
Don’t quite have the hang of things yet…
thanks
J
Networl Configuration in Yast works only with wicked, if you switch to Networkmanager, you have to configure your Network in the Aplett.
These Configuration will not store in /etc/sysconfig/network.
Thanks…so I read the words but don’t understand what they mean. Are you saying that when I go to network devices in Yast, I should select wicked instead of network manager in the drop down box and then save/exit?
Do I need to disable DHCP in yast? if so, how?
Thanks
J
Sorry, I just don’t understand how to translate that into actions. Do you mean that I should select ‘wicked’ and then exit the Network Device window?- is this essentially substituting management of the devices from ‘network manager’ to ‘wicked’?
Where you say that I would" find places there to ‘not use DHCP’", that means 'If I select ‘wicked’ then I should make sure that ‘use DHCP’ is unchecked, e.g. I do not want to use DHCP?
I hate to be dense, but it really isn’t clear to me the entire NetworkManager/Wicked paradigm is doing…Is there a document that describes this?
Thanks
J
To make it possible to configure everything through YaST, you first switch to wicked. Then more the settings must be active. When it is set to NM in YaST, YaST of course blocks everything, because then NM should take over.
Then IMHO, the next choice to make is using DHCP or not. As you told that you want to configure a static IP address, I assumed that you do not want to use DHCP (it is of course possible to configure a DHCP server so that it alwyas sets that one system with a predefined IP address, but I assumed that that is not your goal).
When you switch off DHCP usage, you must be able to set IP address, Netmask, Hostname, DNS server, … in all the tabs there.
When you think everything is OK, then finish YaST lower right. It will edit th files and then up the NIC (depending if you configured it to be up at boot, at connection or whatever).
To the OP:
To clear up confusion and provide complete instructions…
The two main ways to set up network configuration is to use either Wicked (which is a shell which provides some minimal additional features over the usual ifup/ifdown) and Network Manager which is the widely known and used Gnome Network Manager project.
If your machine connects to many networks, you’d want to use Network Manager, as set in YAST > Network Settings > General tab.
Since you say you are configuring a static IP address, that is most often done when the machine is not portable and connects to the network only one way, so you’d most likely select “Wicked” for your network management in YAST > Network Settings > General tab.
You should know though that you can set up a static IP address using Wicked or Network Manager, it’s just a matter of preference.
If you had chosen NM to configure your static network configuration, you would have saved that setting, exited YAST and configured a network connection in NM as usual.
When you select Wicked for configuring network settings,
You save that setting selecting Wicked (if necessary) and then while still in “Network Settings” edit the properties of your chosen network device.
You will be walked through approx 3 forms which allow you to configure static settings or DHCP. Fill out the forms and save.
After configuring your network device, you still have additional settings to set in the two tabs “DNS/Hostnames” and “routing.”
Click on the “DNS/Hostnames” tab and fill in your DNS settings and save.
Click on the “routing” tab and enter your Default Gateway address for either or both the IPv4 and IPv6 devices. Assuming you don’t have virtualization installed on your machine (which would create bridging devices), you don’t have to specify the network device(interface) for your DG.
Save.
Check your settings by running the following
ip addr
ip route
You should have a static address configured and be able to successfully connect to remote hosts on the network.
As you might have noticed by following the above steps, unlike NM which prompts you for all necessary settings on a single (or at most second) form, configuring a static address using YAST/Wicked requires clicking through more than a half dozen forms, and they’re not sequential. Maybe one day someone will create a “wizard” like process that steps you through all the necessary forms so you don’t miss any, but that’s not the case today.
Thank you for your explaination. It was very helpful. I now have a much better understanding between NetworkManager and Wicked. I made several attempts to make a static IP and I am unsuccessful and stuck. Perhaps one could show me the error my ways…
After configuring (in wicked) both the wireless and ethernet devices for static addresses 192.168.1.50/32, and entering a host name, and routing, I get the wireless Icon that shows it is connected to my router, but, bringing up google in web browser says it cant find address.
Per your suggestions:
linux:/etc/sysconfig/network # ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 00:26:18:cc:fd:50 brd ff:ff:ff:ff:ff:ff
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:25:d3:70:d0:65 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.50/32 scope global wlp2s0
valid_lft forever preferred_lft forever
inet6 fe80::225:d3ff:fe70:d065/64 scope link
valid_lft forever preferred_lft forever
linux:/etc/sysconfig/network # ip route
linux:/etc/sysconfig/network #
It appears that the routing is not properly set up, but not sure how to do that. Using Yast2, in the routing tab, I did add 192.168.1.1 as the IPv4 gateway, and I tried two variations, one with the device field empty, the other with wlp2s0 (wireless adapter) selected. Neither option made the connection work. I did not specify any thing in the routing table (don’t think that I should have to)
Any help/suggestions are appreciated.
BTW, for the DNS I used google 8.8.8.8 and 8.8.4.4. Are these correct?
I just checked the routing when NetworkManager is used (and Firefox is working) and using netstat gives the following:
jjh@linux:~> netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp2s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp2s0
jjh@linux:~>
Should I enter these values in the routing table when using wicked?
Thanks
J
You posted your “ip addr” but you didn’t post the following which would display your configured routes including your Default Gateway.
ip route
In any case, pls verify…
Your network id is 192.168.1.0 /24
Your default gateway is 192.168.1.1
Your DNS might be 192.168.1.1 but your are trying to configure public Google DNS using 8.8.8.8 and 8.8.4.4
Questions:
If you are connecting to an Access Point, are you sure you want to configure a static address? That’s typically unusual, almost all the time you want to configure a DHCP client. If you want to be assured of being assigned the same IP address on every connection and you have Admin access for your Access Point, typically you can configure an assigned lease (a fixed IP address to a specific MAC address).
Remember, if you use Wicked, it will only remember the one wireless connection settings, if you connect to another wireless network you will have to destroy your existing settings when you configure new. So, are you sure you want to continue to set up Wicked when using Network Manager will mean that you can configure, save and store multiple connection settings if you connect to different networks?
Your network id is 192.168.1.0 /24 - yes-correct
Your default gateway is 192.168.1.1 - yes-correct
Your DNS might be 192.168.1.1 but your are trying to configure public Google DNS using 8.8.8.8 and 8.8.4.4
(this was a last effort to make things work…I removed the Google NS. Should I put anything for a name server?)
Response to question 1
Yes, my router does allow for a ip reservation and I have considered using that approach - the problem is that my router has a known bug that reservations are not always applied to the client. That is why I wanted my opensuse system to ‘push’ the ip address to the router. I’d still like to make this approach work.
Response to question 2
I did not know about the network restriction. It is, however, not a concern for me in that I only have one network to use.
To the last point about me not posting the results of ‘ip route’…when I issued the command, the result was nothing…the prompt was displayed…which seemed very strange to me.
After trying for the better part of a day, I could not make this work. I fell back to using my router and reserving the address associated with the MAC of the wireless and wired card. It works, not the way I wanted but I can’t argue with success.
This is still the best way to do it, and – in fact – in the industry, is the only sensible way to do it. Could you imagine the chore caused by choosing, for one reason or another, a new network addressing configuration in a network with 2000 or 3000 PCs or more? You would have to go around to every single PC and change the static IP. If, instead, this is handled by reserved IPs in a DHCP server (similar to what you have now done in a consumer router), the changes will only have to be made at the one location, the server or router.
From what you posted, it’s unlikely that you configuring the routing tab in YAST correctly, and without a configured default gateway you’d get the error you described which literally means that your machine has no networking configuration that allows connecting to your destination address.
With all do respect, I am not sure I agree that I did not have the default gateway specified correctly. From the opensuse box point of view, the gateway is the base address of my router which is 192.168.1.1 (or maybe it was 192.168.1.0…in any event, I tried both IP addresses).
If I am incorrect, would you be so kind to tell me explicitly where it is incorrectly configured? I’d like to learn…