# Problem connect to the internet



## L__E__O__N (Oct 4, 2012)

Hello guys! My FreeBSD system is unable to connect to the internet!
I would like to inform you that the network have a proxy squid without user name and password. I tried to assign proxy at rc.conf with the following commnand but nothing happens 

```
setenv http_proxy="http://192.168.170.81:8080/"
```
but still unable to connect in order to add new packages to my system!

Thanks in advance !


----------



## SirDice (Oct 4, 2012)

L__E__O__N said:
			
		

> I tried to assign proxy at rc.conf with the following commnand but nothing happens
> 
> ```
> setenv http_proxy="http://192.168.170.81:8080/"
> ```


It doesn't work that way. Add it to your ~/.cshrc.


----------



## hedgehog (Oct 4, 2012)

SirDice said:
			
		

> It doesn't work that way. Add it to your ~/.cshrc.



The ~/.cshrc is user related file, isn't it better to use /etc/make.conf in order to fetch ports using proxy? Something like this:


```
FETCH_ENV=FTP_PROXY=ftp://name:pass@host:port
FETCH_ENV=HTTP_PROXY=http://name:pass@host:port
```
Of course you can ommit name and password if the proxy doesn't require authorization.


----------



## SirDice (Oct 4, 2012)

hedgehog said:
			
		

> The ~/.cshrc is user related file, isn't it better to use /etc/make.conf in order to fetch ports using proxy?


All roads lead to Rome. Except the one the OP was trying to take


----------



## hedgehog (Oct 4, 2012)

SirDice said:
			
		

> All roads lead to Rome. Except the one the OP was trying to take


True. But what if he use sudo without exporting environment variables to the root account (i.e. by default) ?


----------



## L__E__O__N (Oct 4, 2012)

SirDice said:
			
		

> It doesn't work that way. Add it to your ~/.cshrc.



I add this at ~/.cshrc and when i reboot i receive the follow message: setenv Syntax Error 

this is what i add :

 setenv http_proxy="http://192.168.170.81:8080/".


----------



## SirDice (Oct 4, 2012)

Ah, oops. Missed that. Remove the equal sign.


```
setenv http_proxy http://192.168.170.81:8080/
```


----------



## L__E__O__N (Oct 4, 2012)

The syntax error was gone but still can not connect to the internet


----------



## hedgehog (Oct 4, 2012)

L__E__O__N said:
			
		

> The syntax error was gone but still can not connect to the internet



How exactly you're trying to "connect to the internet"? Is there any output in console?


----------



## L__E__O__N (Oct 4, 2012)

I checked everything and looks fine. I can't fine a reason that can not connect to the internet.

The IP is assigned normally from DHCP and I can ping the other pc to my site to the network normally but I can't ping the other site of the network that there is the proxy.


----------



## L__E__O__N (Oct 4, 2012)

hedgehog said:
			
		

> How exactly you're trying to "connect to the internet"? Is there any output in console?



When i try to ping http://www.google.com

i receive no message . it's just stay there ! 
:\


----------



## SirDice (Oct 4, 2012)

You probably don't have direct access to the internet. That's why you must use a proxy.


----------



## L__E__O__N (Oct 4, 2012)

SirDice said:
			
		

> You probably don't have direct access to the internet. That's why you must use a proxy.



yes , so i use the setenv http_proxy commnad at  ~/.cshrc  but still nothing.

Thank you


----------



## SirDice (Oct 4, 2012)

Explain "nothing"! Explain what you are doing! We are not clairvoyant and we can't see what you are doing.


----------



## L__E__O__N (Oct 4, 2012)

SirDice said:
			
		

> Explain "nothing"! Explain what you are doing! We are not clairvoyant and we can't see what you are doing.




Ok. The aim is that I want to have internet connection to my fresh installed FreeBSD system in order to setup my FreeBSD system via internet etc.

I have a DHCP server that give the right IP to my system. Also I assign the gateway to rc.conf. Then I assign the network  proxy server to the ~/.cshrc. 

Let me explain that my network have 2 different network sites that they have a different IPs 

for example: site 1  192.168.171.10  site 2  192.168.170.10

I am in site one with and I have an IP 192.168.171.12 and I can ping all the PCs at the site 1 but I can't ping the PCs from the site 2, and also proxy server is at site 2.

A typical windows system at my network has an IP from DHCP the gateway and a proxy server assigned at internet explorer and everything works fine.

Any suggestion guys ? :\


----------



## SirDice (Oct 4, 2012)

Ping has nothing to do with a proxy, you have routing issues. Contact your network administrator.

You do not need to add the gateway to /etc/rc.conf, you will get the correct one from DHCP.


----------



## L__E__O__N (Oct 4, 2012)

Ok the problem was solved ! 

The main problem was that a conflict occurs between my freebsd machine with another.

then i did the following steps :

1. i assign proxy server (http and ftp)  to  ~/.cshrc

2. i assign dns server to /etc/resolv.conf

3. i assign gateway to /etc/rc.conf  

with  defaultrouter command 

4. i assign static ip to rc.conf and i disable DHCP due ip conflict error :stud

Thank you very much for your support !


----------



## SirDice (Oct 4, 2012)

If you use DHCP you shouldn't get IP address conflicts. If you do there's something seriously wrong with your DHCP server. Most DHCP servers will try to ping the address before serving it. If something responds the IP is in use and the server will try another IP address.


----------

