# Installing Network Driver



## mrmike19597 (May 8, 2014)

Trying to install RealTek network driver and run into an error.


```
cd /usr
cd ports
cd rtl_bsd_drv_v184

make install

install -0 root -g wheel -m 555 if_re.ko /boot/kernel
install: if_re.ko: No such file or directory
*** Error code 71
```

Am I doing something wrong or did I burn a corrupt .tgz file to disk?

Thanks.


----------



## trh411 (May 8, 2014)

The re(4) driver is built into the GENERIC kernel with the:

```
device    re
```
kernel configuration statement. To verify, execute `kldload if_re`. It should return:

```
root:/root# kldload if_re
kldload: can't load if_re: module already loaded or in kernel
```
So unless you are working wit a CUSTOM kernel, which you neglected to mention, you should already be good to go.


----------



## mrmike19597 (May 8, 2014)

Yes, sorry it is a CUSTOM kernel, what can I do to change that so I can get internet on? I lost all my old hardware in a tornado last week and was only able to save the hard drive so the entire system is just confused of my new hardware. I just never been through this before so really need help.


----------



## trh411 (May 8, 2014)

If I understand correctly, your new Motherboard has on-board ReakTeK Ethernet, which is not getting recognized at boot because your CUSTOM kernel does not include re(4). As a result, you have no network and no Internet. Is that correct?

If so, put the following statement in /boot/loader.conf:

```
if_re_load="YES"
```
and reboot. That will load the if_re.ko kernel module at boot and your RealTek Ethernet should be configured. After your system reboots, execute `pci -lbcev` and make sure a driver has been attached to your RealTek Ethernet device.


----------



## mrmike19597 (May 8, 2014)

Correct, I have no internet.

I have this in my custom kernel


```
device miibus
device re
```

and in loader.conf  I have this:


```
if_re_load="YES"
```

Here is screenshot of the error I get on boot http://i61.tinypic.com/1675agx.jpg


----------



## mrmike19597 (May 8, 2014)

And also typing `kidload if_re` outputs:


```
kidload: can't load if_re: File exists
```


----------



## kpa (May 8, 2014)

You're making it all too complicated. The simplest way to see if the NIC works with the re(4) driver in the kernel you have is to run `ifconfig` and see if the NIC is listed as re0. Just saying that you don't have internet is no information to us because there can dozens and dozens of different reasons why it's not working. Always provide as much information as possible when asking for help.


----------



## trh411 (May 8, 2014)

mrmike19597 said:
			
		

> I have this in my custom kernel
> 
> ```
> device miibus
> ...


Then you do *not* need if_re_load="YES" in /boot/loader.conf. Remove it and reboot.

After you reboot, I'd like to see the output of `uname -a`, `ifconfig` and `pci-lbcev`.


----------



## kpa (May 8, 2014)

mrmike19597 said:
			
		

> and also typing kidload if_re outputs:
> 
> 
> ```
> ...



Well that is a sure sign that the kernel already has the same driver included and the additional driver module you're trying to load can not be used.


----------



## mrmike19597 (May 8, 2014)

Here is screenshot of output for `ifconfig`, `uname -a` and `pci-lbcev` http://i58.tinypic.com/2q34t2b.jpg

I also removed command from loader.conf and when I type `kidload if_re` it now says "command not found".


----------



## trh411 (May 8, 2014)

mrmike19597 said:
			
		

> I also removed command from loader.conf and when I type kidload if_re it now says command not found.


kldload(8), not kidload.
My bad, should be `pciconf -lbcev`. Note the space between the command and the option flags.
Hmm, `ifconfig` does not show the RealTek NIC at all. I'll await the output of `pciconf -lbcev`.


----------



## mrmike19597 (May 8, 2014)

`pciconf -lbcev` says illegal option and gives samples like


```
pciconf -l [-bcev]
pciconf -a
pciconf -r
pciconf -w
```

So I tried `pciconf -l` and got 2 pages of codes, should I send that?


----------



## trh411 (May 8, 2014)

mrmike19597 said:
			
		

> pciconf -lbcev says illegal option


What version of FreeSBD is this? `pciconf -lbcev` works for me on FreeBSD-9.2, FreeBSD-10.0 and FreeBSD-11.0-CURRENT.


			
				mrmike19597 said:
			
		

> So I tried pciconf -l and got 2 pages of codes, should I send that?


No, that does not tell us anything really useful.


----------



## trh411 (May 8, 2014)

Try `pciconf -lv`.


----------



## mrmike19597 (May 8, 2014)

Sorry I am on FreeBSD 7, trying to save some stuff before I upgrade which is why I am trying to get the internet on, my old mobo used realtek and new one does as well. I have another network card I can use which is PCI DGE-530T D-LINK but not sure how to set that one up since I can't find a FreeBSD driver for it.


----------



## kpa (May 8, 2014)

Providing the output of the `ifconfig` command would be very nice too, as I said above there are some very simple ways to debug this type of problems but if you don't want to listen to advice then what can we do?


----------



## wblock@ (May 8, 2014)

That D-Link card is probably supported by FreeBSD 7.  After installing it, run ifconfig(8) to see the new interface name.


----------



## trh411 (May 8, 2014)

kpa said:
			
		

> Providing the output of the `ifconfig` command would be very nice too, as I said above there are some very simple ways to debug this type of problems but if you don't want to listen to advice then what can we do?


You probably missed it because it was included as a link to a jpg a couple posts up, not in-line.


----------



## mrmike19597 (May 8, 2014)

trh411 said:
			
		

> Try `pciconf -lv`.



That worked using pciconf -lbcv, I got like 5 pages long which part should I get for you?


----------



## mrmike19597 (May 8, 2014)

wblock@ said:
			
		

> That D-Link card is probably supported by FreeBSD 7.  After installing it, run ifconfig(8) to see the new interface name.



Can you tell me how to run that? I see all the commands there just unsure which one I should use.. but the DLINK never got my internet on either.


----------



## trh411 (May 8, 2014)

mrmike19597 said:
			
		

> wblock@ said:
> 
> 
> 
> ...


`ifconfig`


----------



## mrmike19597 (May 8, 2014)

I have the `ifconfig` in here http://oi58.tinypic.com/2q34t2b.jpg, did I miss something?


----------



## trh411 (May 8, 2014)

mrmike19597 said:
			
		

> I have the ifconfig in here http://oi58.tinypic.com/2q34t2b.jpg, did I miss something?


I think @wblock@ was suggesting running `ifconfig` after trying the D-Link NIC. The link is with the RealTek NIC, correct?


----------



## mrmike19597 (May 8, 2014)

Is there a manual to setup the D-Link? Like RealTek is re(4) like how I have it set in the kernel configuration. I don't see anything set for D-Link.


----------



## kpa (May 8, 2014)

There is no set up for network cards outside the rc.conf(5) settings and there are no drivers to install. The NIC is either supported or not supported by the kernel. If it is supported it will show up in `ifconfig` output, if it's not it won't show up in the output.

Anyway, you have to upgrade your OS to at least 8.4 to be sure your system is safe against some recent and quite serious security threats. I would just back up the system and install 8.4 from scratch and restore the configurations from the back ups and install the missing software from ports/packages. FreeBSD 8.4 is likely to support your new hardware out of the box. If 8.4 doesn't work for you there is FreeBSD 9.1 that you can also try.


----------



## trh411 (May 8, 2014)

mrmike19597 said:
			
		

> Is there a manual to setup the D-Link? Like RealTek is re(4) like how I have it set in the kernel configuration.. I don't see anything set for D-Link.


The D-Link DGE 530T is supported by the sk(4) driver. That would be specified as "device sk" in the kernel configuration file.


----------



## mrmike19597 (May 8, 2014)

When I do ifconfig with the D-Link in it still shows the same info as shown in jpg picture I posted. If I upgrade FreeBSD won't it delete and overwrite all my work I have saved on it?


----------



## mrmike19597 (May 8, 2014)

trh411 said:
			
		

> mrmike19597 said:
> 
> 
> 
> ...



Thank you, going to try this.


----------



## protocelt (May 8, 2014)

Just to chime in, the D-Link DGE 530T card has multiple revisions. I can't remember which revision ( I think it's Rev. C ), but it's a re-branded Realtek 8169 and uses the re() driver. I have a dead one in my junk drawer.


----------



## trh411 (May 8, 2014)

The D-Link DGE 530T gets specific mention in sk(4), but it is silent on revisions. I do not see the D-Link DGE 530T mentioned anywhere else in the FreeBSD 7.0 Hardware Notes other than the sk(4) driver section.


----------



## protocelt (May 8, 2014)

trh411 said:
			
		

> The D-Link DGE 530T gets specific mention in sk(4), but it is silent on revisions. I do not see the D-Link DGE 530T mentioned anywhere else in the FreeBSD 7.0 Hardware Notes.



Yep, your correct. it uses re() or sk(4) depending on revision. I got bit by that one. I believe I found a PR on it and that's how I found out. This was almost 2 years ago though. I'll see if I can dig up the PR if you'd like.


----------



## trh411 (May 8, 2014)

protocelt said:
			
		

> trh411 said:
> 
> 
> 
> ...


Thanks, but I'm not sure it matters. The OP's NIC is not being recognized by either re(4) or sk(4) at this point.


----------



## mrmike19597 (May 8, 2014)

I didn't have any luck changing re to sk in the configuration and `ifconfig` still shows the same output. D-Link Box does say Ver; C1. Since I lost all other hardware in a tornado I am guessing the system still has my old network settings and looking for my old network card, rc.conf still has hostname, DHCP, Identd set from old hardware; any suggestions?


----------



## mrmike19597 (May 8, 2014)

trh411 said:
			
		

> protocelt said:
> 
> 
> 
> ...



Can you recommend a network card for FreeBSD 7, please?


----------



## protocelt (May 8, 2014)

trh411 said:
			
		

> protocelt said:
> 
> 
> 
> ...



Yeah, IMHO I'd have to agree with @kpa, forgo the headaches, backup and upgrade/install to a supported release.


----------



## mrmike19597 (May 8, 2014)

Is there a manual on how to back up all files and put them on CD? This is why I was trying to get internet access because it is easier to do over FTP, but I don't know the commands to do all this. If I insert a FreeBSD 10 CD and do an install would it delete all my data and www/apache files?


----------



## SirDice (May 8, 2014)

mrmike19597 said:
			
		

> Is there a manual on how to back up all files and put them on CD?


Handbook: 18.5. Creating and Using CD Media



> If I insert a FreeBSD 10 CD and do an install would it delete all my data and www/apache files?


Yes, very likely.


----------



## obsigna (May 8, 2014)

mrmike19597 said:
			
		

> Trying to install RealTek network driver and run into an error.
> 
> 
> ```
> ...



Back to square 1.

So, you downloaded the RealTek driver sources (version 2014) for FreeBSD 7.x and 8.x from their website as I suggested in the other thread. As you found out the long way, this won't work out of the box because your FreeBSD 7.3 got the old (< 2010) re-driver built-into the Kernel.

The least involved way to uses this 2014 driver is in your case to rename the device node in the 2014 driver sources let's say from "re" to "ree" (think of rev. e of RTL8111). The procedure is:


login  as user root
remove the v184 sources dir from /usr/ports, because it does not belong there: `rm -r /usr/ports/rtl_bsd_drv_v184`
create an installation directory at home of user root, move the downloaded driver archive rtl_bsd_drv_v184.tgz in there, and cd to ~/installation.
unpack the dirver archive: `tar -oxzf rtl_bsd_drv_v184.tgz; cd rtl_bsd_drv_v184`
edit the Makefile on line 4 changing KMOD = if_re to KMOD	= if_ree: `nano +4 Makfile`
edit if_re.c on line 75, replacing #include <dev/re/if_rereg.h> with #include "if_rereg.h"
: `nano +75 if_re.c`
edit if_re.c on line 241, changing "re" to "ree": `nano +241 if_re.c`
make the driver (no install): `make`
manually load the driver for testing: `kldload ./if_ree.ko`
see if the interface ree0 is listed in the output of `ifconfig` -- if yes continue with steps 11 to 14
copy if_ree.ko into the directory /boot/modules: `cp if_ree.ko /boot/modules/if_ree.ko`
add a respective load entry to /boot/loader.conf: `echo 'if_ree_load="YES"' >> /boot/loader.conf` 
change the network settings in /etc/rc.conf from ifconfig_re0 to ifconfig_ree0
restart.

I agree with everybody, that you want to upgrade your machine to a recent FreeBSD version, once you saved your data.


----------



## SirDice (May 8, 2014)

I'd try and find a card that _is_ supported on a bare FreeBSD 7.x. Somewhat older 10/100Mbit Intel cards should work, consult your version of the man pages to find one. Once the box has network again you can copy/backup your important files. It'll be slower obviously but it's better than nothing at all. Then wipe the machine with a brand new FreeBSD 9 or 10.


----------



## mrmike19597 (May 8, 2014)

SirDice said:
			
		

> I'd try and find a card that _is_ supported on a bare FreeBSD 7.x. Somewhat older 10/100Mbit Intel cards should work, consult your version of the man pages to find one. Once the box has network again you can copy/backup your important files. It'll be slower obviously but it's better than nothing at all. Then wipe the machine with a brand new FreeBSD 9 or 10.



Yeah I wanted to do it that way but can't find any old cards for sale, I went through the list of supported cards and can't find any for sale to order unless you know of one please let me know. I got the D-Link as mentioned it but it turns out it was revised to use re and not sk, either way still doesn't work so trying the other suggestions.


----------



## mrmike19597 (May 8, 2014)

obsigna said:
			
		

> mrmike19597 said:
> 
> 
> 
> ...



Thanks very much, I admit I am a bit lost, I'll have to figure out the codes to create folder, move file to it off CD because it seems to put it in ports by default. And I'll have to read what you mean by nano and cp ... sorry just used to doing everything via FTP.


----------



## mrmike19597 (May 8, 2014)

Can someone tell me the proper command to make directory named installation?


----------



## trh411 (May 8, 2014)

mrmike19597 said:
			
		

> Can someone tell me the proper command to make directory named installation?


mkdir(1). To create a directory named "installation" in the /root directory, execute `mkdir /root/installation`. This will work regardless of the current working directory since we are fully qualifying the path to the new directory. If /root is already the current working directory, we can simply execute `mkdir installation`, which will create the "installation" directory relative to the current working directory, which is /root, since we have not fully qualified the path to the new directory.


----------



## mrmike19597 (May 8, 2014)

@obsigna, here is what I did and the error I got..


```
3.create an installation directory at home of user root, move the downloaded driver archive rtl_bsd_drv_v184.tgz in there, and cd to ~/installation.
4.unpack the dirver archive: tar -oxzf rtl_bsd_drv_v184.tgz; cd rtl_bsd_drv_v184
5.edit the Makefile on line 4 changing KMOD = if_re to KMOD = if_ree: nano +4 Makfile
6.edit if_re.c on line 75, replacing #include <dev/re/if_rereg.h> with #include "if_rereg.h"
: nano +75 if_re.c
7.edit if_re.c on line 241, changing "re" to "ree": nano +241 if_re.c
8.make the driver (no install): make
9.manually load the driver for testing: kldload ./if_ree.ko

kldload ./if_ree.ko
link_elf_obj: symbol pci_find_cap undefined
kldload: ./if_ree.ko: Unsupported file type
kldoad: can't load ./if_ree.ko: Exec format error
```

Can you please let me know where I went wrong? Thanks


----------



## mrmike19597 (May 8, 2014)

I plugged in a USB Flash Device to move files to, what is the path to get to the USB Storage Drive folder?


----------



## ondra_knezour (May 9, 2014)

mrmike19597 said:
			
		

> I plugged in a USB Flash Device to move files to, what is the path to get to the USB Storage Drive folder?


Depends on configuration, but probably /dev/da0. You have to mount it somewhere and better unmount it again before eject.

`mount -t msdosfs /dev/da0 /mnt`
Copy your files to /mnt
`umount /mnt`

http://www.freebsd.org/doc/handbook/usb-disks.html


----------



## mrmike19597 (May 9, 2014)

ondra_knezour said:
			
		

> mrmike19597 said:
> 
> 
> 
> ...



I typed in `mount -t msdosfs /dev/da0 /mnt` and got the error:

```
mount_msdosfs: /dev/da0: Invalid argument
```

`camcontrol devlist`

```
<HP v125w 0119> at scbus0 target 0 lun 0 (pass0,da0)
```

Using FreeBSD 7.3


----------



## Symbiosis (May 9, 2014)

Are you mounting it with root account?

Which's the output of `gpart show da0`?

Best regards


----------

