Archive for January, 2010
What’s my Gateway?
Thursday, January 7th, 2010In Windows, typing
IPCONFIG /ALL
produces:
Windows IP Configuration
Host Name . . . . . . . . . . . . : host-name
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : domain.local
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek RTL8168C(P)/8111C(P) PCI-E Gigabit Ethernet NIC
Physical Address. . . . . . . . . : 00-24-XX-XX-XX-XX
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IP Address. . . . . . . . . . . . : 64.XXX.XXX.220
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 64.XXX.XXX.1
DHCP Server . . . . . . . . . . . : 209.XXX.XXX.135
DNS Servers . . . . . . . . . . . : 208.67.222.222 208.67.220.220
Lease Obtained. . . . . . . . . . : Thursday, January 07, 2010 12:42:26 PM
Lease Expires . . . . . . . . . . : Thursday, January 07, 2010 8:42:26 PM
You can plainly see all the information you need to know. How do you do that in Linux? Well, the answer depends on which distro you are using and which packages you are using, but here are some answers:
“route -nee” produces (Some fields have been chopped off):
Kernel IP routing table
Destination Gateway Genmask
192.168.100.0 0.0.0.0 255.255.255.0
69.XXX.XXX.0 0.0.0.0 255.255.255.0
169.254.0.0 0.0.0.0 255.255.0.0
0.0.0.0 69.XXX.XXX.1 0.0.0.0
“ip route show” produces:
192.168.100.0/24 dev eth0 proto kernel scope link src 192.168.100.101
69.XXX.XXX.0/24 dev eth1 proto kernel scope link src 69.XXX.XXX.225
169.254.0.0/16 dev eth1 scope link metric 1000
default via 69.XXX.XXX.1 dev eth1 metric 100
“ifconfig” produces:
eth0 Link encap:Ethernet HWaddr 00:d0:b7:3c:dd:4f
inet addr:192.168.100.101 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::2d0:b7ff:fe3c:dd4f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:18365 errors:0 dropped:0 overruns:0 frame:0
TX packets:15981 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1987703 (1.9 MB) TX bytes:11111362 (11.1 MB)
eth1 Link encap:Ethernet HWaddr 00:1a:4d:94:75:43
inet addr:69.XXX.XXX.225 Bcast:69.XXX.XXX.255 Mask:255.255.255.0
inet6 addr: fe80::21a:4dff:fe94:7543/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:59590 errors:0 dropped:0 overruns:0 frame:0
TX packets:11997 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11600972 (11.6 MB) TX bytes:3977507 (3.9 MB)
Interrupt:23 Base address:0×6000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4709 errors:0 dropped:0 overruns:0 frame:0
TX packets:4709 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1042664 (1.0 MB) TX bytes:1042664 (1.0 MB)
“cat /etc/resolv.conf” produces:
#Open DNS
nameserver 208.67.222.222
#Google DNS
8.8.8.8
#Open DNS
nameserver 208.67.220.220
#Google DNS
8.8.4.4
That should give you the information you need.
Dansguardian Content Filtering with Transparent Proxy on Ubuntu 9.10 Karmic
Thursday, January 7th, 2010Content Filtering
(Ubuntu 9.10)
Objectives:
1. Add content filtering to an existing Ubuntu system.
2. Prevent user from bypassing the filtering system.
Software:
Open a terminal and type:
user@system:~$ sudo apt-get install iptables dansguardian squid
Configuration:
1. Squid
Open a terminal and type:
user@system:~$ sudo gedit /etc/squid/squid.conf
change this line:
http_port 3128
to
http_port 3128 transparent
Save file then open a terminal and type:
user@system:~$ sudo /etc/init.d/squid restart
2. Dansguardian
Open a terminal and type:
user@system:~$ sudo gedit /etc/dansguardian/dansguardian.conf
change this line:
UNCONFIGURED
to:
#UNCONFIGURED
Save file then open a terminal and type:
user@system:~$ sudo /etc/init.d/dansguardian start
3. Test Proxy
Open Firefox
Go to http://tits.com or other known bad site.
The site should display.
Now in Firefox select
Edit > Preferences > Advanced > Connection > Settings
Select Manual proxy configuration
In the HTTP Proxy box type: 127.0.0.1 Port: 8080
Place a Check in the box labeled Use this proxy server for all protocols
Click OK then Close
Go to http://google.com and Google should be displayed. Click Refresh and verify it’s still working.
Go to http://tits.com or other known bad site.
The site should show as blocked. You may have to hit refresh for this to work.
At this point, the proxy is working.
Now in Firefox select
Edit > Preferences > Advanced > Connection > Settings
Select No proxy
Click OK then Close
4. Test iptables
iptables is the firewall for Ubuntu. If you are using a firewall front end such as shorewall, etc. then you will have to adapt the concept below to your particular configuration. On a clean install of Ubuntu, this will work as written.
Open a terminal and type:
user@system:~$ sudo iptables -t nat -A OUTPUT -p tcp -m owner ! –uid-owner proxy –dport 80
-j REDIRECT –to-port 8080
This tells the firewall that outgoing web requests requested that are made by anyone other that the proxy should be redirected to the proxy
Open Firefox
Go to http://tits.com or other known bad site.
The site should show as blocked. If so, the firewall is correctly configured as a transparent proxy.
Now, to make the changes permanent.
Open a terminal and type:
user@system:~$ sudo gedit /etc/init.d/tproxy
Add this line:
iptables -t nat -A OUTPUT -p tcp -m owner ! –uid-owner proxy –dport 80
-j REDIRECT –to-port 8080
Save and exit.
Issue this command to make the file executable:
user@system:~$ sudo chmod a+x /etc/init.d/tproxy
Issue this command to make the above script run at startup:
user@system:~$ sudo update-rc.d tproxy
That’s it.
http://www.tranquilpenguin.com
