Re: Network Oddities

2022-05-06 Thread Ron Georgia

"what's in ifconfig.wm0"
cat /etc/ifconfig.wm1
up
media autoselect

I simply copied ifconfig.wm1. And, yes, they were connected to the same 
network.


Why? Total ignorance. I'm learning.

I'd like to thank you and Andy for responding. Believe it or not it does 
help.


On 5/5/22 2:37 PM, Rhialto wrote:

On Tue 03 May 2022 at 13:27:27 -0400, Ron Georgia wrote:

With ethernet cables plugged into both wm0 and wm1. Everything works;
however the only ifconfig file is ifconfig.wm1. Everything works. Reading
through the docs, the recommendation is to have an ifconfig.if for each
interface. The dhcpcd service is up and running without issue. I copy
ifconfig.wm1 to ifconfig.wm0 and restart the network. But I get an error:


Well the first question is: what's in ifconfig.wm0 and ifconfig.wm?
If you try to assign the same address to both, for example, that is
likely to fail.
Also: these two ethernet cables you mention, are they both connected to
the same network, or to different networks? The first is usually not
helpful, unless you specifically set up load sharing or something
similar.

-Olaf.



--
Ron Georgia
"There seems to be a scratch in the prism of my understanding."


Re: Network Oddities

2022-05-06 Thread Ron Georgia

1. Reading through the ifconfig.if man page I found this,
"For each interface (nnX) that is to be configured, there should be 
either an ifconfig_nnX variable in rc.conf(5), or an /etc/ifconfig.nnX file"
Also in "Setting up TCP/IP on NetBSD in practice" document,  I assumed 
the following meant that each interface needed an ifconfig.if file.

/etc/ifconfig.xxx
This file is used for the automatic configuration of the network
interfaces at boot, see ifconfig.if(5)

https://netbsd.org/docs/guide/en/chap-net-practice.html#chap-net-practice-network-config

2. I was setting up a QEMU and NVMM, following  Using virtualization: 
QEMU and NVMM (https://www.netbsd.org/docs/guide/en/chap-virt.html). In 
section 30.3, "Configuring bridged networking on a NetBSD host" they 
walk through creating a tap and a bridge. The first run through my qemu 
vm worked, but the host network stopped working. I rebooted and neither 
the host or the guest had working networks. I am not sure why but it may 
be that I had ifconfig.wm1, ifconfig.tap0, ifconfig.bridge0. I thought 
maybe I would use wm1 for the host and wm0 for the guest. Bad idea.


I did remove the cable from wm0, removed ifconfig.wm0 and 
ifconfig.bridge0 from /etc. I reconfigured ifconfig.tap0 and now 
everything works. In my /etc I have ifconfig.wm1 and ifconfig.tap0


3. "Why are you assuming that this should work?" Honestly, I don't know. 
Pure ignorance I suppose. However, I did learn a lot from this foray.


On 5/4/22 12:32 AM, Andy Ruhl wrote:

On Tue, May 3, 2022 at 10:27 AM Ron Georgia  wrote:


I am having some odd behavior from my NICs or maybe from the network or
dhcpcd, not sure.

With ethernet cables plugged into both wm0 and wm1. Everything works;
however the only ifconfig file is ifconfig.wm1. Everything works.
Reading through the docs, the recommendation is to have an ifconfig.if
for each interface. The dhcpcd service is up and running without issue.
I copy ifconfig.wm1 to ifconfig.wm0 and restart the network. But I get
an error:

sudo service network restart
Stopping network.
Deleting aliases.
Downing network interfaces: wm0 wm1.
Starting network.
Hostname: netverbs57.ronverbs.dev
IPv6 mode: host
Configuring network interfaces: wm0 wm1.
Adding interface aliases:.
Waiting for DAD to complete for statically configured addresses...
ifconfig: SIOCGIFAFLAG_IN6: Can't assign requested address

After a reboot none of the nics have IP addresses. If I restart dhcpcd I
get this error

sudo service dhcpcd restart
dhcpcd not running? (check /var/run/dhcpcd.pid).
Starting dhcpcd.
main: control_open: Connection refused
[1]   Segmentation fault (core dumped) RC_PID= _rc_pid=
_rc_original_stdout_fd= _rc_o...

If I remove /etc/ifconfig.wm0 and reboot, everything returns to normal.
However, if I restart the network, then restart dhcpcd, the same
Sementation fault appears.

I found this when I tried to create a bridge with a tap.

Summary:
With only /etc/ifconfig.wm1, both wm0 and wm1 work. The network can be
restarted and dhcpcd can be restarted.
Add /etc/ifconfig.wm0, reboot, no ip addresses assigned. Cannot restart
dhcpcd, seg fault.
Remove /etc/ifconfig.wm0 and reboot, back to normal. Both nics have
addresses. Restart the network works, but restarting dhcpcd results in a
seg fault.

Anything I can look for?

===
HELPFUL INFO

~> uname -a
NetBSD netverbs57.ronverbs.dev 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12
13:15:55 UTC 2021
mkre...@mkrepro.netbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64


from /etc/rc.conf
# Add local overrides below.
#
hostname=netverbs57.ronverbs.dev
dhcpcd=YES
#dhcpcd_flags="-qM"

Listing /etc
ll /etc | grep ifconfig
-rw-r--r--   1 root  wheel  20B Apr 10 07:09 ifconfig.wm1

cat /etc/ifconfig.wm1
up
media autoselect

ifconfig | grep -w inet
  inet 192.168.1.182/24 broadcast 192.168.1.255 flags 0x0
  inet 192.168.1.186/24 broadcast 192.168.1.255 flags 0x0
  inet 127.0.0.1/8 flags 0x0


sudo service dhcpcd status
dhcpcd is running as pid 241.


ifconfig
wm0: flags=0x8843 mtu 1500
  capabilities=7ff80
  capabilities=7ff80
  capabilities=7ff80
  enabled=0
  ec_capabilities=7
  ec_enabled=2
  address: 68:05:ca:1b:15:f8
  media: Ethernet autoselect (1000baseT
full-duplex,flowcontrol,master,rxpause,txpause)
  status: active
  inet 192.168.1.182/24 broadcast 192.168.1.255 flags 0x0
  inet6 fe80::638a:f74a:53da:36bb%wm0/64 flags 0x0 scopeid 0x1
  inet6 2600:6c5e:1d00:56de:7c0e:e015:3a9a:339c/64 flags 0x0
wm1: flags=0x8843 mtu 1500
  capabilities=7ff80
  capabilities=7ff80
  capabilities=7ff80
  enabled=0
  ec_capabilities=17
  ec_enabled=2
  address: 60:45:cb:71:10:be
  media: Ethernet autoselect (1000baseT
full-duplex,flowcontrol,master,rxpause,txpause)
  status: active
  inet 

Re: Network Oddities

2022-05-06 Thread Andy Ruhl
On Fri, May 6, 2022 at 4:12 PM Ron Georgia  wrote:
>
> 1. Reading through the ifconfig.if man page I found this,
> "For each interface (nnX) that is to be configured, there should be
> either an ifconfig_nnX variable in rc.conf(5), or an /etc/ifconfig.nnX file"
> Also in "Setting up TCP/IP on NetBSD in practice" document,  I assumed
> the following meant that each interface needed an ifconfig.if file.
> /etc/ifconfig.xxx
>  This file is used for the automatic configuration of the network
> interfaces at boot, see ifconfig.if(5)
>
> https://netbsd.org/docs/guide/en/chap-net-practice.html#chap-net-practice-network-config
>

"That is to be configured" is the important phrase in the context of
this thread.

> 2. I was setting up a QEMU and NVMM, following  Using virtualization:
> QEMU and NVMM (https://www.netbsd.org/docs/guide/en/chap-virt.html). In
> section 30.3, "Configuring bridged networking on a NetBSD host" they
> walk through creating a tap and a bridge. The first run through my qemu
> vm worked, but the host network stopped working. I rebooted and neither
> the host or the guest had working networks. I am not sure why but it may
> be that I had ifconfig.wm1, ifconfig.tap0, ifconfig.bridge0. I thought
> maybe I would use wm1 for the host and wm0 for the guest. Bad idea.
>

I don't know, maybe that would work. Seems like a reasonable idea but
I'm not an expert on this topic.

It's also possible you bridged the VM + both real interfaces causing a
loop or something.

> I did remove the cable from wm0, removed ifconfig.wm0 and
> ifconfig.bridge0 from /etc. I reconfigured ifconfig.tap0 and now
> everything works. In my /etc I have ifconfig.wm1 and ifconfig.tap0
>

Yes. 1 interface per subnet for the most part is how you want to
configure things. 1 default gateway per machine (or VRF if you want to
get fancy).

> 3. "Why are you assuming that this should work?" Honestly, I don't know.
> Pure ignorance I suppose. However, I did learn a lot from this foray.

Good, this is the point. Once you drill into how IP networks work from
a host perspective, this all starts making sense. When you put 2
interfaces in the same subnet inside of the same layer 2 network, the
host starts to have problems figuring out which interface to send
packets out of. I deal with this type of thing all the time at work. I
think part of the problem is there is an assumption that "more
interfaces are better". Someone else said the right thing, anytime you
are putting 2 interfaces on the same network you need some "bundling"
or "bonding" method to make it work right. I'm most familiar with LACP
but there are other methods. Maybe that should be your next foray.

Andy

> On 5/4/22 12:32 AM, Andy Ruhl wrote:
> > On Tue, May 3, 2022 at 10:27 AM Ron Georgia  wrote:
> >>
> >> I am having some odd behavior from my NICs or maybe from the network or
> >> dhcpcd, not sure.
> >>
> >> With ethernet cables plugged into both wm0 and wm1. Everything works;
> >> however the only ifconfig file is ifconfig.wm1. Everything works.
> >> Reading through the docs, the recommendation is to have an ifconfig.if
> >> for each interface. The dhcpcd service is up and running without issue.
> >> I copy ifconfig.wm1 to ifconfig.wm0 and restart the network. But I get
> >> an error:
> >>
> >> sudo service network restart
> >> Stopping network.
> >> Deleting aliases.
> >> Downing network interfaces: wm0 wm1.
> >> Starting network.
> >> Hostname: netverbs57.ronverbs.dev
> >> IPv6 mode: host
> >> Configuring network interfaces: wm0 wm1.
> >> Adding interface aliases:.
> >> Waiting for DAD to complete for statically configured addresses...
> >> ifconfig: SIOCGIFAFLAG_IN6: Can't assign requested address
> >>
> >> After a reboot none of the nics have IP addresses. If I restart dhcpcd I
> >> get this error
> >>
> >> sudo service dhcpcd restart
> >> dhcpcd not running? (check /var/run/dhcpcd.pid).
> >> Starting dhcpcd.
> >> main: control_open: Connection refused
> >> [1]   Segmentation fault (core dumped) RC_PID= _rc_pid=
> >> _rc_original_stdout_fd= _rc_o...
> >>
> >> If I remove /etc/ifconfig.wm0 and reboot, everything returns to normal.
> >> However, if I restart the network, then restart dhcpcd, the same
> >> Sementation fault appears.
> >>
> >> I found this when I tried to create a bridge with a tap.
> >>
> >> Summary:
> >> With only /etc/ifconfig.wm1, both wm0 and wm1 work. The network can be
> >> restarted and dhcpcd can be restarted.
> >> Add /etc/ifconfig.wm0, reboot, no ip addresses assigned. Cannot restart
> >> dhcpcd, seg fault.
> >> Remove /etc/ifconfig.wm0 and reboot, back to normal. Both nics have
> >> addresses. Restart the network works, but restarting dhcpcd results in a
> >> seg fault.
> >>
> >> Anything I can look for?
> >>
> >> ===
> >> HELPFUL INFO
> >>
> >> ~> uname -a
> >> NetBSD netverbs57.ronverbs.dev 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12
> >> 13:15:55 UTC 2021
> >>