# setting up network card



## rtsiresy (Apr 13, 2019)

Hello,

I have a freebsd sys installed in a HP desktop machine ... but the thing is it refuse to connect to internet.
I configured it statically by
`ifconfig re0 inet 172.24.0.15 netmask 255.255.255.0`
I have also set *defaultrouter* in */etc/rc.conf* and did it on time with
`route add default 172.24.0.1`
and finally I also set the *nameserver* in */etc/resolv.conf*
`nameserver 172.24.0.1`

the thing is still it has not internet ...
I tried to use dhcp by `ifconfig re0 dhcp` but it says `ifconfig :dhcp :bad value`
and when i run ifconfig it shows:





please help


----------



## VladiBG (Apr 13, 2019)

do you have ping to your gateway at 172.24.0.1
If you want to use DHCP the command is dhclient re0


----------



## rtsiresy (Apr 13, 2019)

Yes I have ping to 172.24.0.1


----------



## VladiBG (Apr 13, 2019)

is your DNS at 172.24.0.1 working? Can you try
`drill google.com`
`ping google.com`


----------



## rtsiresy (Apr 13, 2019)

yes it is working ... I have ping to google.com


----------



## VladiBG (Apr 13, 2019)

then you have Internet connection. What is not working for you?


----------



## rtsiresy (Apr 13, 2019)

I have not ping to google from the freebsd sys ...


----------



## VladiBG (Apr 13, 2019)

Sit in front of your FreeBSD machine and repeat all steps from above to verify if it's has ping to the gateway and if it can resolve addresses using host or drill


----------



## rtsiresy (Apr 13, 2019)

... just like I said It cannot ...


----------



## VladiBG (Apr 13, 2019)

You don't provide any info, don't work doesn't help...

can you ping the gateway?
can you ping 8.8.8.8?
what is the output of the `ifconfig re0`  ?
what is the output of `netstat -rn`  ?
what is the output of the `drill google.com`  ?
what is the output `resolvconf -v`  ?
what is the output of `traceroute -n 8.8.8.8`  ?


----------



## rtsiresy (Apr 13, 2019)

VladiBG said:


> You don't provide any info, don't work doesn't help...



*ifconfig re0:*





*netstat -rn:*




*drill google.com:*




*resolvconf -v:


*


----------



## rtsiresy (Apr 13, 2019)

I also have pfsense firewall which have freeradius on it with a mac filter ...


----------



## VladiBG (Apr 13, 2019)

Your configuration is looking good. Your resolver is working and you resolve google.com if you don't have ping to it you need to check your firewall on your router.


----------



## D-FENS (Apr 13, 2019)

I use this checklist when debugging a network issue:

```
Network problems?
(1) Does the interface have an IP address?
(2) Is IP forwarding enabled on the router?
(3) Check your firewall/NAT settings: router's and jail's.
    All deny rules should log!
    Firewall logs land in /var/log/security.
(4) Are routes configured properly?
    List routes on jail and router.
    Test routes: netstat -rn; traceroute; etc.
(5) Are DNS settings correct?
    What is in /etc/resolv.conf?
    Is the DNS server reachable (routes, etc.)
    Does the firewall allow packets to DNS on port 53?

Tools
* tcpdump
* ipfw: list, table all list, nat show 1 config
* nc / telnet
* netstat -rn
* traceroute
* dig, drill, nslookup
```
First make sure you have set the IP addresses and masks properly - in your case I believe you have.
Check if all machines on the network have the same mask (24 bits).

Then make sure your router has IP forwarding enabled and does NAT properly. It's firewall should pass the packets.
Validate IP works without involving DNS (just use -n switches).
Try this from the router and then from the box: `traceroute -n 8.8.8.8` - it should pass correctly on all levels. Also: `ping -n 8.8.8.8`
If this does not work - again, IP forwarding on router, firewalls on router and box.
Don't forget to check the routing. Do on router and box: `netstat -4nr` . The box must have your router as default gateway. The router must also have a default gateway.

When ping works, try with DNS. if DNS does not work, check your nameserver setting in /etc/resolv.conf.


----------



## D-FENS (Apr 13, 2019)

what's the contents of /etc/resolv.conf


----------



## rtsiresy (Apr 15, 2019)

roccobaroccoSC said:


> what's the contents of /etc/resolv.conf



It's all shown in the above messages ... everything is correct but it just refuse to connect ... want to know why ... ??
It is a physical desktop ... i don't use jail ... 
I tryed to do same with a freeBSD virtualbox guest on my windows pC ... first I set the network mode into bridged networking then I started the VM .... once again all configs are good but have no ping to outside [internet] ...


----------



## rtsiresy (Apr 15, 2019)

I have ipfw enabled on the freebsd system ... with:
myservices = 22,80,443
allowed service = any


----------



## rtsiresy (Apr 15, 2019)

and this is ping result :


----------



## balanga (Apr 15, 2019)

Maybe try a different cable... Sometimes if your cable is loose or has been slightly moved it has become disconnected.


----------



## rtsiresy (Apr 15, 2019)

hey ... thanks for the advice ... but it tunred out some other computers took too many bandwith ... the time they were shutdown , ping worked perfectly ...


----------



## D-FENS (Apr 15, 2019)

Make sure you have firewall logging on:
`sysrc firewall_logging="YES"`

And also - all deny rules need to have `log` keyword.

Then the denied packets will be logged in /var/log/security. Show us the log and your IPFW rules and we could take a look. Otherwise it's just speculation.


----------



## rtsiresy (Apr 15, 2019)

roccobaroccoSC said:


> Make sure you have firewall logging on:
> `sysrc firewall_logging="YES"`
> 
> And also - all deny rules need to have `log` keyword.
> ...


Now I have ping ... 
I use firewall quiet all the long so no log message were kept ... sorry ...


----------



## D-FENS (Apr 15, 2019)

How will you know if somebody is trying to attack you? Firewall logging is quite essential for security and network debugging.


----------

