Oddity re. order of ifconfig commands

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Oddity re. order of ifconfig commands

chohag
I have two laptops, both on the same wifi network, one with linux and one with openbsd.

I also string a cable between their ethernet ports for maximum speed which I bring up manually at each and because I'm too lazy to automate it, that's 10.100.200.2/24 on linux and 10.200.200.1/24 on openbsd.

With the other side working fine (I'd detached my openbsd laptop to take it out and reattached it later) I attempted to bring up the ethernet but got the commands wrong, and this ensued:

drogo# pkill -f re0
drogo# ifconfig re0 10.100.200.1/24 # oops forgot up
drogo# ping 10.100.200.2
PING 10.100.200.2 (10.100.200.2): 56 data bytes
ping: sendmsg: Host is down
ping: wrote 10.100.200.2 64 chars, ret=-1
^C

Then:

drogo# ifconfig re0 up
drogo# ping 10.100.200.2
PING 10.100.200.2 (10.100.200.2): 56 data bytes
ping: sendmsg: Host is down

Forgot the IP I gave it? In that case:

drogo# ifconfig re0 10.100.200.1/24
drogo# ping 10.100.200.2
PING 10.100.200.2 (10.100.200.2): 56 data bytes
^C ## No 'Host is down' but maybe I was impatient.

Then even putting them together all in one as I should have originally (ifconfig re0 up 10.100.200.1/24) had the same "Host down" result so I tried to put it back to normal:

drogo# ifconfig re0 down
drogo# ifconfig re0 up 10.100.200.1/24
drogo# ping 10.100.200.2
PING 10.100.200.2 (10.100.200.2): 56 data bytes
^C
--- 10.100.200.2 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss

Finally to just get it to work I reset the whole stack and did it the way I should have originally:

drogo# sh /etc/netstart
re0: no lease.......... sleeping
rum0: bound to 192.168.1.23 from 192.168.1.1 (84:be:52:c8:b8:52)
drogo# pkill -f re0
drogo# ifconfig re0 up 10.100.200.1/24
drogo# ping 10.100.200.2
PING 10.100.200.2 (10.100.200.2): 56 data bytes
64 bytes from 10.100.200.2: icmp_seq=0 ttl=64 time=0.767 ms

So everything's fine in the end but why did my mismatched commands above not work although it seems like the result, ultimately, should be the same?

My /etc/hostname.{rum,re}0 files just contain 'dhcp' and, in the case of rum0, a list of join instructions.

Matthew

Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

Andrew Luke Nesbit-2
On 14/07/2019 10:35, [hidden email] wrote:
> I also string a cable between their ethernet ports for maximum speed which I bring up manually at each and because I'm too lazy to automate it, that's 10.100.200.2/24 on linux and 10.200.200.1/24 on openbsd.

Is there documentation that explains how to configure this kind of
point-to-point Ethernet connection, and associated routing tables, on
OpenBSD?

Andrew
--
OpenPGP key: EB28 0338 28B7 19DA DAB0  B193 D21D 996E 883B E5B9

Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

Roderick
In reply to this post by chohag

On Sun, 14 Jul 2019, [hidden email] wrote:

> I also string a cable between their ethernet ports for maximum speed

Was it a crossover cable?

> drogo# pkill -f re0

Do you have somewhere a program called re0 running?!

> drogo# ifconfig re0 10.100.200.1/24

Why the name of a whole net for just an address of an interface?

Rodrigo

Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

Roderick
In reply to this post by Andrew Luke Nesbit-2

On Sun, 14 Jul 2019, U'll Be King of the Stars wrote:

> Is there documentation that explains how to configure this kind of
> point-to-point Ethernet connection, and associated routing tables, on
> OpenBSD?

I never had problems with it: just as normal LAN.

Point to point. Hmm. I used slip+tcp/ip instead of zmodem to
transfer files between rs232. Now remains ppp, a litle more
complicated.

Rodrigo

Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

Todd C. Miller-3
In reply to this post by chohag
On Sun, 14 Jul 2019 12:35:32 +0300, [hidden email] wrote:

> I have two laptops, both on the same wifi network, one with linux and one wit
> h openbsd.
>
> I also string a cable between their ethernet ports for maximum speed which I
> bring up manually at each and because I'm too lazy to automate it, that's 10.
> 100.200.2/24 on linux and 10.200.200.1/24 on openbsd.
>
> With the other side working fine (I'd detached my openbsd laptop to take it o
> ut and reattached it later) I attempted to bring up the ethernet but got the
> commands wrong, and this ensued:
>
> drogo# pkill -f re0

I'm assuming this is to kill off any dhclient for re0?

> drogo# ifconfig re0 10.100.200.1/24 # oops forgot up
> drogo# ping 10.100.200.2
> PING 10.100.200.2 (10.100.200.2): 56 data bytes
> ping: sendmsg: Host is down
> ping: wrote 10.100.200.2 64 chars, ret=-1

I'm not sure what you are tying to do here.  You haven't configured
re0 with an IP address.  I suspect you really wanted to run "dhclient
re0" instead.

 - todd

Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

Andrew Luke Nesbit-2
In reply to this post by Roderick
On 14/07/2019 14:05, Roderick wrote:
>
> On Sun, 14 Jul 2019, U'll Be King of the Stars wrote:
>
>> Is there documentation that explains how to configure this kind of
>> point-to-point Ethernet connection, and associated routing tables, on
>> OpenBSD?
>
> I never had problems with it: just as normal LAN.

Yes, but there are caveats and it requires manual configuration.
Depending on the OS there are different sorts of gremlins to look out
for when configuring the connection.

> Point to point. Hmm. I used slip+tcp/ip instead of zmodem to
> transfer files between rs232. Now remains ppp, a litle more
> complicated.

When I said "point to point" I meant an Ethernet connection that goes
directly from one machine to another (with a crossover adapter if the
NIC can't be configured to do this manually or via autodetection).  Such
a connection would not pass through any hub, switch, or router.

I don't know if that was clear.

I've used SLIP+TCP/IP or PPP+TCP/IP over RS232 in the age of dialup
ISP's.  And also for a months when I was trying to access my personal
workstation on my university campus, from home.

But I just followed instructions to get the darn thing working and I can
not remember how it is configured or how I would get it to work now.

THIS would certainly be an interesting and useful thing to learn about.

Also, I would like to learn how to use ZMODEM (and other protocols) to
transfer files again.  I haven't used it since my BBS days.

^ All of this kind of knowledge needs to be documented thoroughly.
Hardware specifications need to be made clear too.  Preferably all open
source.  I'm keen to do this (but first is getting my web site and CMS
set up).  Knowing how to quickly set up such a communications link can
rescue an emergency scenario.

But the primary use case now is to be able to directly interface between
a laptop computer (running OpenBSD) and an out of band management
interface on a server (BMC/IPMI).

Andrew
--
OpenPGP key: EB28 0338 28B7 19DA DAB0  B193 D21D 996E 883B E5B9

Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

chohag
In reply to this post by Andrew Luke Nesbit-2
U'll Be King of the Stars writes:
> On 14/07/2019 10:35, [hidden email] wrote:
> > I also string a cable between their ethernet ports for maximum speed which I bring up
>  manually at each and because I'm too lazy to automate it, that's 10.100.200.2/24 on li
> nux and 10.200.200.1/24 on openbsd.
>
> Is there documentation that explains how to configure this kind of
> point-to-point Ethernet connection, and associated routing tables, on
> OpenBSD?

There's nothing to it really.

If there are no other network connections up (ignoring lo0) then doing this on one machine:

  # ifconfig re0 up a.b.c.1/24

and this on another:

  # ifconfig re0 up a.b.c.2/24

Will, if they are on the same ethernet segment (as, for example, when they're both connected to the same switch or directly with a crossover cable*), and considering any firewalls present en route, allow them to communicate with one another on the configured address.

Of course each re0 should be changed to the appropriate device name on the machine, and a, b and c must be chosen so as not to conflict with any other address that may be present on existing network devices (or networks they route to, such as the internet).

Matthew

[*] Or, if you have a machine made after the stone age with autosensing ethernet hardware, any cable.

Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

chohag
In reply to this post by Roderick
Roderick writes:
>
> On Sun, 14 Jul 2019, [hidden email] wrote:
>
> > I also string a cable between their ethernet ports for maximum speed
>
> Was it a crossover cable?

I have no idea how long it's been since I had to care.

I *did* mention that the physical setup already worked and was subsequently made to work. There is zero chance of hardware being at issue (almost -ed).

> > drogo# pkill -f re0
>
> Do you have somewhere a program called re0 running?!

43832 dhclient: re0
76984 dhclient: re0 [priv]

> > drogo# ifconfig re0 10.100.200.1/24
>
> Why the name of a whole net for just an address of an interface?

I don't know what this means. How else should I give an ethernet device which otherwise has no network configured at all a full address?

Todd C. Miller writes:
> On Sun, 14 Jul 2019 12:35:32 +0300, [hidden email] wrote:
> > drogo# pkill -f re0
>
> I'm assuming this is to kill off any dhclient for re0?

Indeed. It's a laptop so it's sanest to have all devices try dhcp so I can usually just plug in and have things work. The 3-odd seconds extra boot time is irrelevant.

> > drogo# ifconfig re0 10.100.200.1/24 # oops forgot up
> > drogo# ping 10.100.200.2
> > PING 10.100.200.2 (10.100.200.2): 56 data bytes
> > ping: sendmsg: Host is down
> > ping: wrote 10.100.200.2 64 chars, ret=-1
>
> I'm not sure what you are tying to do here.  You haven't configured
> re0 with an IP address.  I suspect you really wanted to run "dhclient
> re0" instead.

The problem is that the line should have included 'up', as it did later on when the correct process was followed start to finish.

I don't know what you mean by "haven't configured re0 with an IP address". What else is 10.100.200.1/24?

Why does the absense of up in that command screw up that attempt and subsequent attempts (see my original post for the full transcript), and is there a less crude recovery mechanism than sh /etc/netstart?

Matthew

Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

Stuart Henderson
On 2019-07-14, [hidden email] <[hidden email]> wrote:
> Roderick writes:
>>
>> On Sun, 14 Jul 2019, [hidden email] wrote:
>>
>> > I also string a cable between their ethernet ports for maximum speed
>>
>> Was it a crossover cable?
>
> I have no idea how long it's been since I had to care.

Oh you do have to care - a typical crossover cable often won't work for
gigabit interfaces :)

>> > drogo# ifconfig re0 10.100.200.1/24 # oops forgot up

"up" is done implicitly when setting an address. (there has been some suggestion
of changing that, there are some situations where you want to do things between
setting the address and bringing it up, but it hasn't happened yet).

>> > drogo# ping 10.100.200.2
>> > PING 10.100.200.2 (10.100.200.2): 56 data bytes
>> > ping: sendmsg: Host is down
>> > ping: wrote 10.100.200.2 64 chars, ret=-1
>>
>> I'm not sure what you are tying to do here.  You haven't configured
>> re0 with an IP address.  I suspect you really wanted to run "dhclient
>> re0" instead.
>
> The problem is that the line should have included 'up', as it did later on when the correct process was followed start to finish.
>
> I don't know what you mean by "haven't configured re0 with an IP address". What else is 10.100.200.1/24?
>
> Why does the absense of up in that command screw up that attempt and subsequent attempts (see my original post for the full transcript), and is there a less crude recovery mechanism than sh /etc/netstart?

No idea what is going on but I don't expect (and don't see) a difference between
using "up" or not when configuring an address, I manually configure addresses on
ethernet interfaces and vlans quite often and don't see any problems.


Reply | Threaded
Open this post in threaded view
|

Re: Oddity re. order of ifconfig commands

Roderick
In reply to this post by chohag

On Sun, 14 Jul 2019, [hidden email] wrote:

> I don't know what you mean by "haven't configured re0 with an IP address".
> What else is 10.100.200.1/24?

A subnet. But it seems to be a valid way of doing:

ifconfig re0 inet 10.100.200.1 netmask 255.255.255.0

That is new to me. Perhaps lays the problem in your previous configuration
of re0?

Rod.