# nfe0 link state is down. Why? (Solved)



## dalpets (Apr 13, 2021)

I am running an ethernet NIC on 12.2.
The startup script link state is shown as 'down' but 'ifconfig' shows nfe0 as active.
I don't seem to have a supported NIC. I haven't been able to find the one I am using, so as to query the compatibility list. How do I do that?
I have run `more  /var/run/dmesg.boot` but I don't know what to look for.


```
root@Mistletoe:~ # ifconfig
sk0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
        ether 00:13:d4:e1:cb:8e
        media: Ethernet autoselect (none)
        status: no carrier
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
nfe0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8210b<RXCSUM,TXCSUM,VLAN_MTU,TSO4,WOL_MAGIC,LINKSTATE>
        ether 00:13:d4:e1:b7:40
        inet 192.168.1.111 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
```


```
root@Mistletoe:~ # netstat -nr
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            192.168.1.1        UGS        nfe0
127.0.0.1          link#3             UH            lo0
192.168.1.0/24     link#2             U          nfe0
192.168.1.111      link#2             UHS      lo0

Internet6:
Destination                       Gateway                       Flags     Netif Expire
::/96                             ::1                           UGRS        lo0
::1                               link#3                        UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS   lo0
fe80::/10                         ::1                           UGRS     lo0
fe80::%lo0/64                     link#3                        U     lo0
fe80::1%lo0                       link#3                        UHS   lo0
ff02::/16                         ::1                           UGRS        lo0
```


```
root@Mistletoe:~ # netstat nr
Active Internet connections
Proto Recv-Q Send-Q Local Address          Foreign Address        (state)
tcp4       0      0 192-168-1-111.tp.18238 163.171.208.94.443     CLOSED
tcp4      24      0 192-168-1-111.tp.21124 204.109.59.195.443     CLOSE_WAIT
tcp4       0      0 192-168-1-111.tp.50925 204.109.59.195.443     CLOSE_WAIT
tcp4       0      0 192-168-1-111.tp.29751 192.0.73.2.443         CLOSED
tcp4      63      0 192-168-1-111.tp.21962 hwcdn.net.443          CLOSED
tcp4       0      0 192-168-1-111.tp.18876 syd09s14-in-f2.1.443   CLOSED
tcp4       0      0 192-168-1-111.tp.18875 syd15s15-in-f14..443   CLOSED
tcp4       0      0 192-168-1-111.tp.18874 syd15s16-in-f2.1.443   CLOSED
tcp4       0      0 192-168-1-111.tp.18873 syd09s15-in-f14..443   CLOSED
tcp4       0      0 192-168-1-111.tp.18872 syd09s22-in-f3.1.443   CLOSED
tcp4       0      0 192-168-1-111.tp.18871 syd15s16-in-f3.1.443   CLOSED
tcp4       0      0 192-168-1-111.tp.18870 syd09s23-in-f4.1.443   CLOSED
tcp4       0      0 192-168-1-111.tp.18869 syd09s23-in-f4.1.443   CLOSED
tcp4       0      0 192-168-1-111.tp.51968 ec2-44-242-93-71.443   ESTABLISHED
tcp4       0      0 192-168-1-111.tp.16083 65.8.135.56.443        CLOSED
tcp4       0      0 192-168-1-111.tp.48130 82.221.107.34.bc.80    CLOSED
tcp4       0      0 192-168-1-111.tp.29392 82.221.107.34.bc.80    CLOSED
```


Thanks for any help.


----------



## SirDice (Apr 13, 2021)

Look at the `status` when you look at the ifconfig(8) output. An interface that has a "live" ethernet cable plugged in will have a `status: active`.



dalpets said:


> I don't seem to have a supported NIC.


You appear to have two; sk(4) and nfe(4).


----------



## dalpets (Apr 14, 2021)

I have loaded 
	
	



```
if_nfe0-load="YES"
```
 in  boot/loader.conf 
(sko status is 'no carrier' so I have not included it in above file).
I also have etc/pf.conf  that contains nfe0 & reference to 192.168.1.111 there, but the startup script still results in 'link state down' & `localhost:631` is unobtainable


----------



## SirDice (Apr 14, 2021)

dalpets said:


> if_nfe0-load="YES"


This is not correct. You don't load individual interfaces, you load the driver, it should look like this:

```
if_nfe_load="YES"
```
But you don't need to load nfe(4) or sk(4), both are already included in the GENERIC kernel. 



dalpets said:


> I also have etc/pf.conf that contains nfe0 & reference to 192.168.1.111 there, but the startup script still results in 'link state down' & localhost:631 is unobtainable.


I have no idea what you mean here. Localhost is 127.0.0.1 and ::1 and those addresses are set on the lo0 interface. This has nothing to do with nfe0 or sk0. Besides that, if you look at `ifconfig nfe0` you can clearly see it's active and has an IP address assigned to it.


----------



## dalpets (Apr 14, 2021)

I thought, given your references to nfe(4) & sk(4), that  they were central to getting this to work. So If I don't have to load anything, do I instead need to get out my crystal ball? I wish I understood the theory behind all of this then I wouldn't be flying completely blind most of the time!
BTW how do I become privy to what is loaded in the GENERIC kernel from version to version?


----------



## SirDice (Apr 14, 2021)

dalpets said:


> I thought, given your references to nfe(4) & sk(4), that they were central to getting this to work


I don't understand what's confusing for you. 



dalpets said:


> The startup script link state is shown as 'down' but 'ifconfig' shows nfe0 as active.


Are you using DHCP here? That would explain the "down" message, the interface will go down then up to do a DHCP request. 



dalpets said:


> I don't seem to have a supported NIC.


This the part I don't understand, your ifconfig(8) output clearly shows two network interfaces, nfe0 and sk0. And nfe0 is active and has an IP address. So what's the problem?



dalpets said:


> BTW how do I become privy to what is loaded in the GENERIC kernel from version to version?


Look at the source code: https://cgit.freebsd.org/src/tree/sys/amd64/conf/GENERIC?h=releng/13.0


----------



## dalpets (Apr 14, 2021)

DHCP was setup when I installed 12.2.
I understand that I have two working interfaces & that nfe0 is active & has an IP address but what is needed to make it work?
You seem to be saying it should work automatically. Is there a diagnostic to see what is going on?
If we put an index  label on what I am trying to achieve here what would it be in terms of the users' handbook or the Administrator's networking handbook.


----------



## SirDice (Apr 14, 2021)

dalpets said:


> what is needed to make it work?


Make what work? You keep saying something doesn't work without explaining _what_ doesn't work.


----------



## dalpets (Apr 14, 2021)

SirDice said:


> Make what work? You keep saying something doesn't work without explaining _what_ doesn't work.


Well if nfe wasn't there something wouldn't work (you would know that), otherwise it would be superfluous, unless of course there are a multitude of networking things it could affect & you want to know which it is.
In my case `localhost:631` doesn't work!
Your references to nfe(4) said to load it in boot/loader.conf That turns out to be a wild goose chase given your later advice that is not necessary because it's already in the kernel. I can now see it in the generic kernel that you have provided.


----------



## SirDice (Apr 14, 2021)

dalpets said:


> In my case localhost:631 doesn't work!


That has nothing to do with your network cards. As I explained earlier localhost is a special hostname, it always refers to the 127.0.0.1 (IPv4) and ::1 (IPv6) IP addresses. And those are always bound to the lo0 interface. That lo0 interface is there, it's not a "real" interface.


----------



## dalpets (Apr 14, 2021)

on this test machine I have; 
	
	



```
cups_enable="YES"
```
 in etc/rc.conf  & my printer is seen as a usb connection in the startup script.
I have also setup  /etc/pf.conf to allow the lan to talk to cups on my machine. This approach worked with em0 on my main machine.
What more do I need to activate `localhost:631` to setup my printer?


----------



## SirDice (Apr 14, 2021)

You seem to be missing some basic TCP/IP knowledge. That localhost or 127.0.0.1 IP address _always_ refers to the host itself. A network service that is bound to 127.0.0.1 cannot be accessed from _outside_ that host. Every host will have a 127.0.0.1 address and this will _always_ point to itself.


```
[A]----[B]
```
Simple network, with host A and host B. Host A has 192.168.10.1 and host B is 192.168.10.2. localhost or 127.0.0.1 on host A refers to itself; i.e. host A. 127.0.0.1 on host B also refers to itself; host B. If your network service runs on host A on 127.0.0.1 you cannot access it from host B. If you need to access that service on host A from host B you will need to bind that service to the address 192.168.10.1. Then you can access it from B by addressing the IP address of A.


----------



## dalpets (Apr 14, 2021)

SirDice said:


> You seem to be missing some basic TCP/IP knowledge. That localhost or 127.0.0.1 IP address _always_ refers to the host itself. A network service that is bound to 127.0.0.1 cannot be accessed from _outside_ that host. Every host will have a 127.0.0.1 address and this will _always_ point to itself.


Is there a diagnostic I can run & then post it here for assessment?


----------



## SirDice (Apr 14, 2021)

What's there to diagnose? A `ping localhost` will always work (there's something seriously wrong if that doesn't work) because you're basically pinging yourself. You can ping(8) host A from B and vice versa but that will only tell you both hosts can talk to each other.


----------



## dalpets (Apr 14, 2021)

It looks like I'm at last ripe to return to Windoze


----------



## SirDice (Apr 14, 2021)

TCP/IP is universal. If you don't understand TCP/IP on FreeBSD you're not going to understand it on Windows either. At least on FreeBSD you get all the tools and documentation to play with and learn from for free with the OS.


----------



## Deleted member 67440 (Apr 14, 2021)

What kind of printer?


----------



## SirDice (Apr 14, 2021)

There's already a six(!) page thread about that issue here: https://forums.freebsd.org/threads/localhost-631-printer-problem-solved.79565


----------



## tingo (Apr 14, 2021)

dalpets said:


> The startup script link state is shown as 'down' but 'ifconfig' shows nfe0 as active.


It is quite normal for a configured (you know, one you want to use and therefore have configured it in /etc/rc.conf) network interface to show state "down" during startup, one of the things the startup scripts does is to set your configured network interfaces up (and also add any other configurations from /etc/rc.conf). So if you pay close attention, you will see that the network interface changes state from "down" to "active" during startup.


----------



## chrbr (Apr 14, 2021)

Dear dalpets,
for playing with TC/IP you might want to try the examples in the "Client/Server" section of nc(1). If I am not wrong the tool with the long name netcat is available in all standard FreeBSD installations because it lives in /usr/bin/nc. You will need two console sessions. One for the server and one for the client. It is most convenient to see both at the same time. Therefore it is best to try it using X with two terminals as xterm(1) or any other terminal emulator.


----------



## dalpets (Apr 15, 2021)

SirDice said:


> TCP/IP is universal. If you don't understand TCP/IP on FreeBSD you're not going to understand it on Windows either. At least on FreeBSD you get all the tools and documentation to play with and learn from for free with the OS.


I understand that you think most of us want to be hand fed & you act accordingly & hold back your answers with a hard resolve.

Printers in Windows normally provide drivers out of the box. You don't, as a rule, have to understand TCP/IP to get a printer working in Windows. The difference here is that Unix requires you to understand  minutae  to get things working properly. Some people enjoy that, but it is generally acknowledged that Unix, for most, is a very complicated animal to learn. I don't have a problem with that, but I expect to be reasonably facilitated in the learning process & not to be blind sided with technicalities. Complexity can come down the track, once there is some maturity. A baby doesn't walk straight out of the womb! And it can't understand adult (unix) speak then, either.
A technocrat, as a teacher, needs to understand the tenets of learning & that everybody has different needs & abilities, facets that are difficult to assess outside the face to face classroom, like here ! But let's try, eh!


----------



## dalpets (Apr 15, 2021)

SirDice said:


> There's already a six(!) page thread about that issue here: https://forums.freebsd.org/threads/localhost-631-printer-problem-so


It worked for em0 but it's not working for nfe0......& I'm now told not to use the '0' in nfeO during configuration. Why then was it included with the emo configuration that worked?


----------



## dalpets (Apr 15, 2021)

fcorbelli said:


> What kind of printer?


Mono LaserJetPro M404dn


----------



## dalpets (Apr 15, 2021)

tingo said:


> It is quite normal for a configured (you know, one you want to use and therefore have configured it in /etc/rc.conf) network interface to show state "down" during startup, one of the things the startup scripts does is to set your configured network interfaces up (and also add any other configurations from /etc/rc.conf). So if you pay close attention, you will see that the network interface changes state from "down" to "active" during startup.


Please see thread 3 above


----------



## dalpets (Apr 15, 2021)

SirDice said:


> Make what work? You keep saying something doesn't work without explaining _what_ doesn't work.


I asked you for a label to indicate the process I am trying to use to get  localhost:631 working.  You didn't answer!
How can I follow it up in documentation if you don't specify it with a label that I can follow through with?
It simply remains murky without one!


----------



## dalpets (Apr 15, 2021)

SirDice said:


> That has nothing to do with your network cards. As I explained earlier localhost is a special hostname, it always refers to the 127.0.0.1 (IPv4) and ::1 (IPv6) IP addresses. And those are always bound to the lo0 interface. That lo0 interface is there, it's not a "real" interface.


I understand the nexus here: ie., the theory, but practising it is something else!


----------



## dalpets (Apr 15, 2021)

Could someone kindly list, as dot points, the procedure to make localhost:631 work (with nfe0) so that I can get more than just a disjointed appreciation of what is involved & so I can get on with the rest of my life.
Many here have graciously helped with suggestions previously (6 pages worth: em0) but only one suggestion worked, indicating just how complex Unix solutions can be perceived by its user base, even though something like this apparently should be super simple.

Thanks for your understanding.


----------



## richardtoohey2 (Apr 15, 2021)

Sadly I think you've wandered into the deep woods and it might be easier to start from scratch again.

I think you've ended up with a lot of things tweaked, changed, etc. so it's rather difficult to know where to start.  This thread also seems to go from NICs to pf and then CUPs etc. so it's a bit jumbled.

If you want an easy desktop user experience - especially with printers - definitely Windows or Mac and _maybe_ Linux.

Under the hood they all work in very similar ways, but Microsoft and Apple have spent billions hiding that.


----------



## dalpets (Apr 15, 2021)

richardtoohey2 said:


> Sadly I think you've wandered into the deep woods and it might be easier to start from scratch again.
> 
> I think you've ended up with a lot of things tweaked, changed, etc. so it's rather difficult to know where to start.  This thread also seems to go from NICs to pf and then CUPs etc. so it's a bit jumbled.
> 
> ...


Thanks. I think I'll stay here, hoping that I will strike a chord that will enlighten me, earlier than later. I'm prepared to go back to square one on my quest for a working nfe0 with localhost:631, hopefully by a logical dot point framework provided by someone here. This is for a second FBSD test box. The jumble you talk of doesn't apply to this new test box & in any event, at worst, its youth can be reclaimed with a quick reinstallation. 

My main box has a working em0 & localhost interface, but using that approach hasn't worked for the above nfe0 test box.


----------



## richardtoohey2 (Apr 15, 2021)

Well, please take this as a gentle suggestion - this sort of thing doesn't encourage people to help:


dalpets said:


> It looks like I'm at last ripe to return to Windoze


For some things, that really _might_ be the best solution.

I've re-read this thread and I'm still confused about what the issue(s) are?  Are you happy that nfe0 is a NIC and that it can be used on your network?  That seems to be step 1.

(But as others have said, that's nothing to do with localhost and port 631 - that doesn't need the network.  But let's start at the beginning!)


----------



## dalpets (Apr 15, 2021)

richardtoohey2 said:


> Well, please take this as a gentle suggestion - this sort of thing doesn't encourage people to help:
> 
> For some things, that really _might_ be the best solution.
> 
> ...


I would expect those comments from a person with your ranking talking to a newbie but it's the high priest culture here, fortunately only existing in a very small circle, that seems to want to make things much more difficult than they are, creating a frustration, at a distance, that I wouldn't expect you to understand.

Believe me I'm no dummy, so try and patronize me for a while, if you will. I hope to get the vibes soon, to every ones' relief.
Thanks for your indulgence.


----------



## bakul (Apr 15, 2021)

dalpets said:


> Could someone kindly list, as dot points, the procedure to make localhost:631 work (with nfe0) so that I can get more than just a disjointed appreciation of what is involved & so I can get on with the rest of my life.


You need to first install cups. See https://docs.freebsd.org/en/articles/cups/ Once cups is properly configured and running it will start listening on port 631.

If cups is listening on localhost:631, nfe0 doesn't matter as cups can only be accessed from the same machine. nfe0 matters only if you want *other* computers on your local network to access the printer. But if you want that, it should be possible to configure cups for that. I  haven't done this in over 15 years but if you run into issues, I will be happy to help figure them out.


----------



## richardtoohey2 (Apr 15, 2021)

Ranking? Make things more difficult? Patronize?

I've got CUPS working once on OpenBSD.  Now I use a Windows machine or Mac machine for printing.

Scanning was a PITA - so I got a printer that scans to USB and then plug that into whatever computer I'm using.

I've never installed a graphical interface on FreeBSD, nor CUPS.  Just trying to help, but you don't appreciate it, so I'll try and help others.

I'm feeding a troll so


----------



## tingo (Apr 15, 2021)

dalpets said:


> Please see thread 3 above


Yet your first post (#1) shows nfe0 as "active". Explain?


----------



## dalpets (Apr 15, 2021)

richardtoohey2 said:


> Ranking? Make things more difficult? Patronize?
> 
> I've got CUPS working once on OpenBSD.  Now I use a Windows machine or Mac machine for printing.
> 
> ...


You have an attitude problem my friend.I sort of sensed that when you called me out, but I was prepared to give you the benefit of the doubt. Sure enough you showed your colors. Putting 2 & 2 together you saw my posts as an irritant & you were insulted because you see yourself as one of the intolerant high priests. Me! a troll how laughable. I wouldn't know how. That you came out of the wood work to put me down shows you are the one who has a latent troll agenda.
I can only hope your social skills will improve & I hope you feel better about yourself soon. 
Help people don't put them down.


----------



## dalpets (Apr 15, 2021)

tingo said:


> Yet your first post (#1) shows nfe0 as "active". Explain?


....but that has not helped me one iota.


----------



## dalpets (Apr 15, 2021)

bakul said:


> You need to first install cups. See https://docs.freebsd.org/en/articles/cups/ Once cups is properly configured and running it will start listening on port 631.
> 
> If cups is listening on localhost:631, nfe0 doesn't matter as cups can only be accessed from the same machine. nfe0 matters only if you want *other* computers on your local network to access the printer. But if you want that, it should be possible to configure cups for that. I  haven't done this in over 15 years but if you run into issues, I will be happy to help figure them out.


root@Mistletoe:~ # pkg install cups
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent versions of packages are already installed
root@Mistletoe:~ #

I have configured /etc/rc.conf & etc/pf.conf based on if.config -a

So, what next, thank you.
This is getting tedious for all of us!


----------



## SirDice (Apr 15, 2021)

Turn off the firewall.


----------



## dalpets (Apr 15, 2021)

bakul said:


> You need to first install cups. See https://docs.freebsd.org/en/articles/cups/ Once cups is properly configured and running it will start listening on port 631.
> 
> If cups is listening on localhost:631, nfe0 doesn't matter as cups can only be accessed from the same machine. nfe0 matters only if you want *other* computers on your local network to access the printer. But if you want that, it should be possible to configure cups for that. I  haven't done this in over 15 years but if you run into issues, I will be happy to help figure them out.


Cups is part of 12.2 by default


----------



## SirDice (Apr 15, 2021)

dalpets said:


> Cups is part of 12.2 by default


It's not. It's a port/package, ergo third party software. Nothing outside of the FreeBSD OS is 'default'.


----------



## dalpets (Apr 15, 2021)

SirDice said:


> It's not. It's a port/package, ergo third party software. Nothing outside of the FreeBSD OS is 'default'.


I was basing that on the Distrowatch website that says it is a 12.2 stable package.  Apparently, all of the packages listed there are 3rd party, which I was not aware of, except for the office suites, .


----------



## SirDice (Apr 15, 2021)

dalpets said:


> I was basing that on the Distrowatch website that says it is a 12.2 stable package


All versions of FreeBSD use one and the same ports tree. So every version has the same applications and versions available to them. Versions of third party applications are not bound to the version of the OS as is the case with a lot of Linux distributions. Besides that, third party applications (aka ports and packages) are not considered part of the OS (that's why they're called _third party_). Nothing is installed "by default", you have to install everything yourself.


----------



## dalpets (Apr 15, 2021)

SirDice said:


> Turn off the firewall.


It's already turned off in /etc/rc.conf


----------



## dalpets (Apr 15, 2021)

The issue is resolved now. It essentially related to the non-configuration of the file etc/devfs.rules/, which wasn't mentioned in well intentioned replies.
By enlarge, all I wanted to know was what files needed to be configured for success. As it turns out they were rc.conf, pf.conf & devfd.rules, hence my request for a simple dot point guide. That guide unfortunately was not forthcoming 
My finding really was about as parsimonius as it gets, & excludes the need for, in some cases, complex theoretical diversions. If I had pursued the latter course I would have needed another lifetime to find the answer.-.

That would be one way to achieve eternal life!

All I really needed to know was how to drive the car, not how components in the engine worked before I could be licensed to get behind the wheel.


----------

