Friday, August 15, 2008

Linux Networing Tips

Proxy settings in fedoracore ,


requirements :-

One public ip with all gateway and all, two lan cards for Proxy pc , two lan cables and local ip.

first we need enter into the linux system as root user ,
then we need to start squid service for that
we have to use following commands :

service squid status
service squid start
service squid stop


for ip configuration

Method # 1: GUI tool system-config-network

Type the following command at shell prompt (open x terminal):
$ system-config-network & Now select your Ethernet card (eth0 or eth1) and click on Edit button. You can now setup IP address, netmask, default gateway and other properties.

You can obtain IP address using DHCP or setup manually. Once IP address assigned, click on Ok button to save the changes. You can activate card by clicking on Activate button.

Method # 2: Command line tool system-config-network-tui

If you don’t have X windows GUI installed type the following command at shell prompt:
# system-config-network-tui &

You will see text based GUI as above. Select your Ethernet card (eth0 or eth1) and hit [Enter] or [F12] special key.

You can obtain IP address using DHCP or setup manually. Once IP address assigned, click on Ok button to save the changes

Method #3: Edit configuration files stored in /etc/sysconfig/network-scripts/

You can configure network card by editing text files stored in /etc/sysconfig/network-scripts/ directory. First change directory to /etc/sysconfig/network-scripts/:
# cd /etc/sysconfig/network-scripts/
You need to edit / create files as follows:

  • /etc/sysconfig/network-scripts/ifcfg-eth0 : First Ethernet card configuration file
  • /etc/sysconfig/network-scripts/ifcfg-eth1 : Second Ethernet card configuration file

To edit/create first NIC file, type command:
# vi ifcfg-eth0
Append/modify as follows:

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:30:48:56:A6:2E
IPADDR=10.10.29.66
NETMASK=255.255.255.192
ONBOOT=yes

Save and close the file. Define default gateway (router IP) and hostname in /etc/sysconfig//network file:
# vi /etc/sysconfig/network
Append/modify configuration as follows:
NETWORKING=yes
HOSTNAME=www1.nixcraft.in
GATEWAY=10.10.29.65

Save and close the file. Restart networking:
# /etc/init.d/network restart

Make sure you have correct DNS server defined in /etc/resolv.conf file:
# vi /etc/resolv.conf
Setup DNS Server as follows:
nameserver 10.0.80.11
nameserver 10.0.80.12
nameserver 202.67.222.222

Save and close the file. Now you can ping the gateway/other hosts:
$ ping 10.0.80.12
Output:

PING 10.0.80.12 (10.0.80.12) 56(84) bytes of data.
64 bytes from 10.0.80.12: icmp_seq=1 ttl=251 time=0.972 ms
64 bytes from 10.0.80.12: icmp_seq=2 ttl=251 time=1.11 ms

You can also check for Internet connectivity with nslookup or host command:
$ nslookup cyberciti.biz
Output:

Server:         10.0.80.11
Address: 10.0.80.11#53

Non-authoritative answer:
Name: cyberciti.biz
Address: 75.126.43.232

You can also use host command:
$ host nixcraft.in
Output:

nixcraft.in has address 75.126.43.232
nixcraft.in mail is handled by 10 mail.nixcraft.in.

like that only

See also



once if we confirm with squid service is working then we need to go as primary steps ,

those ip configuration parts

could say ,

eth0 having public like

ip is : xx.yy.zz.ww
subnet: 255.255.255.0
gatway :xx.yy.zz.wa


after setting this ip for eth0 we need to go to the eth1 which we need to set a local ip

could say ,

eth1 having this local ip like ,

ip is : 192.168.205.30
subnet mask :255.255.255.0
gateway: --------------



Here we dont need to give a gate way ip why because if we give a that ip addres we may not get inter net thats why we have leave it

then we have one more major role that is routing

here we have route the these local ip in eth0 because regquests of the local ip those will goes to the public ip for that only we need routing .

for that command lin

route add -net ip
or

route add deafault gw ip

like that we need to route

in manual line
we need open the Network then there is option route

we need to click on that then we need to go there and we need type the local ip ther.


after completion of that we need open terminal

then in that terminal try to start the squid service

with service squid start t
hen if it is okay try to stop it

with service squid stop then try to go for following commands

in terminal ,

vim /etc/squid /squid.conf


if you enter this command you may get one configuration file ,

In that if want do some changes try to press "i"
then if want save changes and close for that press "ESc" then "shift +:"
then "wq " or " qw"
then "enter "
if dont want save changes and close for that
press "ESc" then "shift +:"
then "q" and "enter"
please following guide for the configuraton of squid



Introduction
The utility squid is an internet proxy server that can be used within a network to distribute an internet connection to all the computers within the network. One central computer is connected to the internet through any means such as dial-up, cable modem, ISDN, DSL, or T1, runs squid, and thus acts as the firewall to the internet. Because it is a proxy, it has the capabilities to log all user actions such as the URLs visited. There are many features that can be configured in squid. This guide is meant to be a quick start guide for those who are eager to get squid working and then configure it from there.

squid Configuration
Squid uses the configuration file squid.conf. It is usually located in the /etc/squid directory. Access through the proxy can be given by individual IP addresses or by a subnet of IP addresses.
In squid.conf search for the default access control lists(acl) and add the following line below them:
acl mynetwork src 192.168.1.0/255.255.255.0 (for subnet)
acl mynetwork src 192.168.1.10/255.255.255.0 (for individual IP)
Then add the access control list named "mynetwork" to the http_access list with the following line:
http_access allow mynetwork
The default port for the proxy is 3128. Uncomment the following line and replace 3128 with the desired port :

http_port 3128

Starting, stopping, and restarting squid
Assuming you have the runlevel scripts installed you can use the following commands as root:

Start squid/etc/rc.d/init.d/squid start
Restart squid /etc/rc.d/init.d/squid restart
Stop squid/etc/rc.d/init.d/squid stop

or issue the following TWO commands as root:
squid -z
squid

or configure squid to start at boot time using your runlevels.

In users system try to add add proxy server that should be our system local ip in inter conncetion use proxy 192.168.205.30 and prot num is 3128
then you may get inter net

No comments: