How to set Auto eth0 IP address

Hello,

I want to set my desktop IP address to always be 192.168.1.2. The NetworkManager connects to the network automatically and the IP address is assigned randomly. I can set up another connection in NetworkManager and always change over. But is there any way to make the default eth0 interface to be permanently set to a certain address (using NetworkManager, not ifup)?

Thanks.

Go to yast–>network devices–>network settings
And then choose processing/more details–> Network IP and choose static and write this IP in gap.

That is you LAN IP
It’s configured in your router, usually via address reservation

Where is processing/more details–> Network IP? When I open YAST there’s only 4 tabs: Global Options, Overview, Hostname/DNS and Routing.

The only place I know where you can set IP address in is the Overview -> Edit controller. But it’s disabled when NetworkManager is enabled. I can’t see any other place wher you can set an IP address with the NetworkManager being the default network control method. And NetworkManager itself doesn’t have any options for changing eth0 settings. Everything’s automatic.

I’m happy to add my own setting to NM, but it always chooses the default one when the computer boots up. If the NM is the only place to set an IP address, how can I make it to choose my new interface by default?

My router distributes IP addresses randomly. I thought it must have been the router where you set permanent IP addresses, but it didn’t work. So I changed my NAS IP to manual and it always stays as I made it. But my desktop and laptops always change their IPs. Do you think the router is faulty? It’s a D-Link DVA-G3670B. Maybe it is broken, I set my wireless name to be hidden but it’s always visible. Then I set all IPs to be set by certain MAC addresses. This worked until I rebooted the router and then all hell broke loose - all IPs got messed up and I had to disconnect every single device and reconnect them one by one to get certain IPs. Does this sound weird to you?

Address reservation is usually set by MAC because that is unique to each device connecting.

You know there is sure to be a manual for your router.
Rebooting it should not be the cause of any issues.

Yes, I know. I know how to set IPs in the router. Well, I thought I knew until I bought that D-Link DVA-G3670B which doesn’t reserve anything. My previous router did that, it reserved IP addresses based on MAC. Not this one. I guess it’s a bug in the firmware. That’s why I wanted to set my IPs manually because the router couldn’t.

And until D-Link fix their firmware, is there a way to make NetworkManager to set the default eth0 IP address manually?

It might be possible with the gnome Network Manager applet. I tried that for a while, as described in:
Gave up Knetworkmanager. Made Networkmanager-GNOME work on KDE4!
and it was possible to setup system connections. However, I didn’t try changing the “Auto eth0” connection.

On 04/13/2011 06:36 AM, linuxoidoz wrote:
>
> Yes, I know. Well, I thought I knew until I bought that D-Link
> DVA-G3670B which doesn’t reserve anything. My previous router did that,
> it reserved IP addresses based on MAC. Not this one. I guess it’s a bug
> in the firmware. That’s why I wanted to set my IPs manually because the
> router couldn’t.

Most routers are programmed to try to serve the same address to a given MAC
until they are rebooted, which resets the tables in the firmware. At that point,
it will be first come - first served. If your DHCP server does not have to
ability to supply an IP number based on MAC address, then any fixed IPs will
have to be (1) located outside the dynamic range of the server to avoid
collisions, and (2) set up in the Connection Manager if using NetworkManager, or
with YaST is using ifup. With eth0, you are likely using the latter method as I do.

Not implementing MAC - IP correspondence is not a bug in the firmware. Most home
routers are severely memory limited, thus many features are missing.

I just changed my Netgear as 2 of the LAN ports had gone flaky - It had MAC - IP reservation

My replacement TP-Link also supports it

I need it too, because I forward specific ports to my LAN IP

On Wed April 13 2011 05:06 am, linuxoidoz wrote:

>
<snip>
> This worked until I rebooted the router and
<snip>
>
linuxoidoz;

When you “rebooted” did you press the reset switch? Pressing the reset switch
loads the factory defaults and you will lose any configuration changes you
made.
Most D-Link Routers allow you to save the the configuration on a local machine
and your settings can be restored if needed.


P. V.
“We’re all in this together, I’m pulling for you.” Red Green

My router has the IP-MAC reservation which didn’t work. All devices got IPs randomly. I thought it was the router’s firmware bug so I tried not to reboot the router because after reboot it loast all IP allocations.

The problem was I wanted a static IP for my NAS so that autofs could mount it. It did while both the router and NAS were ON. As soon as I reboted either of them, the NAS’s IP address got changed to a different IP and then of course autofs couldn’t mount it. I had to disconnect everything from the router and re-connect all in turn so that every device got a particular IP address. This was when the IP range was 192.168.1.2-10. When I changed the range to 192.168.1.100-110, all devices on the network seemed to keep their IP addresses after reboot. But autofs stopped mounting the NAS for no reason.

This is why I think it’s a bug in the firmware. My previous router kept the IP-MAC reservation after reboot without a problem and all my devices were set to auto DHCP. With this stupid router I think the only option is to set static IPs to everything.

Pressing the reset switch loads the factory defaults

I didn’t press the reset switch, rather ON/OFF switch or rebooted from the admin menu.

What should be the DHCP lease time? It used to be 24 h some time ago. Then I upgraded firmware and it changed to 0.0066666666 or something like that which I’ve just noticed when I was changing the range and it complained the time is wrong. So I changed it to 1 h. When it was 24 I found it was nearly impossible to allocate static IP if it’s already been taken by something else. That’s why the only option was to physically disconnect everything and reconnect one by one.

As I understand your D-Link does IP-MAC reservation but it doesn’t work? When you setup DHCP on the router and what ranges did you use and did you change it when you moved the addresses to the 192.168.1.100 -110 ? Also, I think the ranges have to be larger than 100-110 more like 100-152. I have Gnome NetworkManager so I have the drop down box to set NM automatic DHCP or Manual.

You can also use IP or ifconfig to set the ip addresses on your machines. Ifdown, set ip address/mask, etc., ifup
man IP
man ifconfig
.
Check the D-Link manual about using the IP-MAC reservation and DHCP range. I think the reserved Mac - IP addresses may need to be outside the DHCP range or vice versus. Then if you still think the D-Link is flaky (not unusual) try resetting it to factory settings and start over.

Lease time is too frequent on my machine, despite the 10800 whatever is seems like every 20sec it does a release/renew cycle.

My router IP is 192.168.1.1. Initially the range was set to 192.168.1.2-10 and IP-MAC reservation didn’t work. I thought what the hell, I’ll change it to 192.168.1.100-110 just for the sake of it. And the IP-MAC seemed to start working. I only have 6 devices, that’s why I set the range to have 10.

You can also use IP or ifconfig to set the ip addresses on your machines.

But, excuse my ignorance, what allocates the IP address: a router or whatever you put in YAST?

Well, I think I need to ask a broader question here. All I want is to allow only registered MAC devices to connect to my network and to have all IP static for the sake of server automount. How can I do that? What should I do to set static addresses and MAC filtering in openSUSE?

I think the reserved Mac - IP addresses may need to be outside the DHCP range

Wait a minute. I thought the whole point was to create a range of available addresses and make them assigned to certain MACs so that nothing else can connect.

From the D-Link manual:

DHCP Client status
Your DVA-G3670B ADSL Router is configured, by default, to be a DHCP server. This means that it can assign an IP address, subnet mask, and a
default gateway address to computers on your LAN. The default range of IP addresses the DVA-G3670B will assign are from 192.168.1.2 to
192.168.1.254. Your computer (or computers) needs to be configured to Obtain an IP address automatically (that is, they need to be configured as
DHCP clients.)

and all I want is to have 6-10 IPs statically assigned to MACs.

If you have a Linux machine that’s on all the time, set that up as the DHCP server and disable the inadequate one in the router.

On Wed April 13 2011 09:36 pm, linuxoidoz wrote:

>
> My router IP is 192.168.1.1. Initially the range was set to
> 192.168.1.2-10 and IP-MAC reservation didn’t work. I thought what the
> hell, I’ll change it to 192.168.1.100-110 just for the sake of it. And
> the IP-MAC seemed to start working. I only have 6 devices, that’s why I
> set the range to have 10.
>
>> You can also use IP or ifconfig to set the ip addresses on your
>> machines.
> But, excuse my ignorance, what allocates the IP address: a router or
> whatever you put in YAST?
>
> Well, I think I need to ask a broader question here. All I want is to
> allow only registered MAC devices to connect to my network and to have
> all IP static for the sake of server automount. How can I do that? What
> should I do to set static addresses and MAC filtering in openSUSE?
>
>> I think the reserved Mac - IP addresses may need to be outside the DHCP
>> range
> Wait a minute. I thought the whole point was to create a range of
> available addresses and make them assigned to certain MACs so that
> nothing else can connect.
>
> From the D-Link manual:
>> DHCP Client status
>> Your DVA-G3670B ADSL Router is configured, by default, to be a DHCP
>> server. This means that it can assign an IP address, subnet mask, and a
>> default gateway address to computers on your LAN. The default range of
>> IP addresses the DVA-G3670B will assign are from 192.168.1.2 to
>> 192.168.1.254. Your computer (or computers) needs to be configured to
>> Obtain an IP address automatically (that is, they need to be configured
>> as
>> DHCP clients.)
> and all I want is to have 6-10 IPs statically assigned to MACs.
>
linuxoidoz;

You can configure your network card to either use dhcp for network
information(IP,mask,gateway,DNS) or do it manually with static entries. The
static IP addresses MUST lie outside the range assigned by dhcp. Configure
your dhcp server to dish out IPs in the range, say, 192.168.1.100 -
192.168.1.253 and then use IPs in the range 192.168.1.2-192.168.1.99 for your
static IPs. To setup your network card for static IPs see:

http://opensuse.swerdna.org/susenic.html

If you have a small network with only a few machines you could turn off dhcp
on the router and use static addresses on all your machines. Although the
method of setting IP, mask, gateway and DNS are dependent on the OS, the
principle is the same on all OSs.


P. V.
“We’re all in this together, I’m pulling for you.” Red Green

The static IP addresses **MUST **lie **outside **the range assigned by dhcp.

This one I didn’t know. Really? I guess this makes sense. But then how do I make the IP-MAC filter and only allow those MACs to connect to the network if the router DHCP is disabled?

Umm…
That’s not the behaviour I experience. Address reservation is in my experience, that a LAN IP address can be reserved for a specific device (MAC)
I have DHCP range 100>200 and just one reserved by MAC reservation. It works.

On Wed April 13 2011 10:05 pm, PV wrote:
<snip>

>
> If you have a small network with only a few machines you could turn off dhcp
> on the router and use static addresses on all your machines. Although the
> method of setting IP, mask, gateway and DNS are dependent on the OS, the
> principle is the same on all OSs.

PS: If you have a laptops that needs to connect to a number of different
networks it would be best to run dhcp for these. But your desk tops/servers
can use static.


P. V.
“We’re all in this together, I’m pulling for you.” Red Green

Alright, now I feel totally dumb in this area, my network knowledge perceptions are crashing down. time for me to start asking dumb questions. :slight_smile:

  1. How to make LAN a little safer to allow only MY computers to connect? (MAC filtering?)
  2. How to mount a file sever: by server name, dynamic IP and hostname-IP mapping or by server IP and static server IP?

What’s MAC filtering good for? Is it for what I think it is for - extra security? Or I’m wrong?