You are not logged in.

#1 2011-07-20 13:10:26

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

need help with new network settings for my gateway

Hi everyone,

I noticed the following message when network starts on my gateway

Warning: This functionality is deprecated.
  Please refer to /etc/rc.conf on how to define a single wired
  connection, or use a utility such as netcfg.

Then I realized the way network settings should be written in rc.conf has changed. But I can't figure out how this should be done.

Currently, my set up is the following (old way):

INTERFACES=(eth0 eth1)
eth0="dhcp"
eth1="eth1 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255"
ROUTES=(!gateway)

eth0 is on DHCP because the IP is dynamically assigned my ISP.
eth1 has a fix IP because it's on the LAN side.

No problem to use DHCP on eth0 with the new settings.
But for eth1, I don't know what I am supposed to write for gateway.

Wiki isn't clear on that one either, and it looks like many articles still refer to the old way.

Any guidance appreciated, thanks.

Last edited by brazzmonkey (2011-07-25 12:14:27)


what goes up must come down

Offline

#2 2011-07-20 14:04:17

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: need help with new network settings for my gateway

brazzmonkey wrote:

Hi everyone,

I noticed the following message when network starts on my gateway

Warning: This functionality is deprecated.
  Please refer to /etc/rc.conf on how to define a single wired
  connection, or use a utility such as netcfg.

Then I realized the way network settings should be written in rc.conf has changed. But I can't figure out how this should be done.

Currently, my set up is the following (old way):

INTERFACES=(eth0 eth1)
eth0="dhcp"
eth1="eth1 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255"
ROUTES=(!gateway)

eth0 is on DHCP because the IP is dynamically assigned my ISP.
eth1 has a fix IP because it's on the LAN side.

No problem to use DHCP on eth0 with the new settings.
But for eth1, I don't know what I am supposed to write for gateway.

Wiki isn't clear on that one either, and it looks like many articles still refer to the old way.

Any guidance appreciated, thanks.

brazzmonkey,

you can't define 2 interfaces the old way (even though I saw some tricky workaround somewhere in the forums).

Use, f.e., netcfg:

Comment your old lines.

In /etc/rc.conf insert:

NETWORKS=(Eth0-dhcp Eth1-static)
DAEMONS=(..... !network @net-profiles ....)

In /etc/network.d create 2 files:

First one is named  Eth0-dhcp.
Contents:

CONNECTION="ethernet"
DESCRIPTION="Whatever text"
INTERFACE=eth0
HOSTNAME="your hostname"
IP="dhcp"
DHCP_TIMEOUT=15

Second one is named Eth1-static.

Contents:

CONNECTION='ethernet'
DESCRIPTION='whatver'
INTERFACE='eth1'
HOSTNAME='hname'
IP='static'
ADDR='192.168.0.10'
GATEWAY='192.168.0.1'      # your gateway IP
DNS=('192.168.0.1')        # your DNS server

The names Eth0-dhcp and Eth1-static are not magic. They just must be the same in rc.conf and in /etc/network.d.

Hope it helps.

mektub

PS: netcfg must be installed.

Last edited by Mektub (2011-07-20 14:07:05)


Follow me on twitter: https://twitter.com/johnbina

Offline

#3 2011-07-20 14:43:51

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: need help with new network settings for my gateway

Thanks Mektub for the detailed answer.
eth1 fails probably because I'm unable to set GATEWAY correctly. What is expected here? Using old setup, route command gives me "*" as gateway...

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         1.16.138.213.dy 0.0.0.0         UG    202    0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
213.138.16.0    *               255.255.255.0   U     202    0        0 eth0

what goes up must come down

Offline

#4 2011-07-20 15:07:58

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: need help with new network settings for my gateway

brazzmonkey,

I don't see why it should fail if you leave the GATEWAY out, since if your 192.168.0.0 local network is closed, i.e. doesn't have a connection to the internet
or some other network, it will not have a gateway,

I hope someone more knowledgeable can jump in and explain that.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#5 2011-07-20 15:17:22

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: need help with new network settings for my gateway

Me neither.
It fails with this message:

RTNETLINK answers: File exists

Thanks anyway.


what goes up must come down

Offline

#6 2011-07-20 16:18:11

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: need help with new network settings for my gateway

Your default route is set by dhcp, as per the first profile, so do not set any gateway in the second profile.

Offline

#7 2011-07-20 16:47:54

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: need help with new network settings for my gateway

Actually I had to comment out gateway, hostname and dns in the configuration file.


what goes up must come down

Offline

#8 2011-07-25 12:28:34

brazzmonkey
Member
From: between keyboard and chair
Registered: 2006-03-16
Posts: 818

Re: need help with new network settings for my gateway

I come back to this thread because I need to automatically connect my wired networks.

So I decided to use net-auto-wired. It's OK for eth0, which is my internet connection.
Because eth1 is static IP as defined in its profile, I also need to run net-profiles.
Basically, both net-auto-wired (for eth0) and net-profiles (for eth1) are used, it works but I think this is a bit redundant, and not really KISS (not really straightforward, and network config is cluttered).

Well, I guess I'm not looking for advices, just giving my opinion...


what goes up must come down

Offline

Board footer

Powered by FluxBB