Archive for September 2012
How To Setup Default umask Under Linux?
Umask is the number subtracted from the standard permissions when creating a file. Example: each new folder is by default created with 777, so when umask is set to 022, the result is that the permissions will be 777 – 022 = 755.
Most of the time umask will already be set by your distro to 022 but you can change it if you like. You can see what umask value is set with:
If you want to change umask for temporally,
Note: These value will stay until you log out and then return to its default value.
To make it permanent, edit /etc/bashrc or to your ~/.bash_profile.
Most of the time umask will already be set by your distro to 022 but you can change it if you like. You can see what umask value is set with:
# umask
0022If you want to change umask for temporally,
# umask 0044
Note: These value will stay until you log out and then return to its default value.
To make it permanent, edit /etc/bashrc or to your ~/.bash_profile.
route add in Linux
Route manipulates the kernel’s IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig program. |
When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables. |
Add static route using “route add”: |
# route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0 |
If you want persistent static route, you need to edit /etc/sysconfig/network-scripts/route-eth0 file to define static routes for eth0 interface. |
# vim /etc/sysconfig/network-scripts/route-eth0 |
GATEWAY0=192.168.1.1 |
NETMASK0=255.255.255.0 |
ADDRESS0=192.168.100.0 |
Save and close the file. Restart networking: |
# service network restart |
Verify new routing table by, |
# route –n or # netstat –nr |
Change Default User Home Directory While Adding A New User
By default, when we create or add users to Linux System, user’s default home directory is created to /home. To change default directory to /opt/, we need to change few settings as mentioned below: | |||||||||
| |||||||||
STEP 1: Open /etc/default/useradd | |||||||||
| |||||||||
# nano /etc/default/useradd | |||||||||
The default home directory defined by HOME variable, find line that read as follows: | |||||||||
| |||||||||
HOME=/home replace to HOME=/opt/ | |||||||||
| |||||||||
Save and close the file. Now you can add user using regular useradd command: | |||||||||
| |||||||||
# useradd uddika | |||||||||
# passwd -d uddika | |||||||||
| |||||||||
Verify user information: | |||||||||
| |||||||||
# finger uddika | |||||||||
Output: | |||||||||
|
Range of IPS on single Ethernet
How to create a range of ip addresses on ethx. Create a range file in /etc/sysconfig/network-scripts
[root@daddylinux~]# cd /etc/sysconfig/network-scripts
[root@daddylinux~]# nano ifcfg-eth0-range1 Enter this Parameters
DEVICE=eth0 BOOTPROTO=static HWADDR=00:04:75:D4:C8:F9 IPADDR_START=192.168.0.6 IPADDR_END=192.168.0.10 CLONENUM_START=1 NETMASK=255.255.255.0 ONBOOT=yes TYPE=Ethernet
CLONENUM_START -- interface clone number to start using for this range. # eg "1"
Which would start at eth0:1 Configuring Squid Proxy Server
Sure Squid server is a popular open source GPLd proxy and web cache. It has a variety of uses, from speeding up a web server by caching repeated requests, to caching web, name server query , and other network lookups for a group of people sharing network resources. It is primarily designed to run on Linux / Unix-like systems. Squid is a high-performance proxy caching server for Web clients, supporting FTP, gopher, and HTTP data objects. Unlike traditional caching software, Squid handles all requests in a single, non-blocking, I/O-driven process. Squid keeps meta data and especially hot objects cached in RAM, caches DNS lookups, supports non-blocking DNS lookups, and implements negative caching of failed requests. Squid consists of a main server program squid, a Domain Name System lookup program (dnsserver), a program for retrieving FTP data (ftpget), and some management and client tools.
1. Check the necessary RPM
#rpm –q squid
if it's not installed first install it
2. Set the default gateway and the DNS on the proxy server, so it has a direct connection as an internet.
#system-config-network-tui
3. Give the information about your local network on the proxy server.
#nano /etc/squid/squid.conf
Press CTRL + W
Search – our_networks
4. Uncomment this lines
#acl our_networks src 192.168.1.0/24 192.168.2.0/24 //Remove # mark
#http_access allow our_networks //Remove # mark
5. Save (CTRL + O) and Exit (CTRL + X) file
6. Start the proxy service
#service squid start
#chkconfig squid on
Settings up proxy clients
The proxy client is an application that required internet through the proxy server
EX – Internet Explorer, Mozilla Firefox
Fire Fox
Edit --> Preferences --> Advanced --> Network --> Settings --> manually proxy configuration
http proxy : 192.168.2.101 port : 3128 // proxy server IP and port number
Now clients have to access internet through proxy………
Controlling web access through proxy
1. Open the following file
#nano /ect/squid/squid.conf
Press CTRL + W
Search – # http_access deny all
Put all the rules that you want to control web access through proxy under the above comment. All the block rules must come before the allow rules
• To block unwanted website
acl blockweb dstdomain .facebook.com .yahoo.com .google.com
http_access deny blockweb
• To block unwanted file download
acl blockfile urlpath_regex –i exe$ mp3$ avi$ rar$
http_access deny blockfile
• To allow POP3/ SMTP to access mail through proxy server
acl allowmail proto POP3 SMTP
http_access allow allowmail
2. Save (CTRL + O) and exit (CTRL +X) the file
3. Reload squid service
#service squid reload
---------------------------------------------------------
List of acl tags and examples
http://wiki.squid-cache.org
---------------------------------------------------------
1. Check the necessary RPM
#rpm –q squid
if it's not installed first install it
#yum install squid
2. Set the default gateway and the DNS on the proxy server, so it has a direct connection as an internet.
#system-config-network-tui
3. Give the information about your local network on the proxy server.
#nano /etc/squid/squid.conf
Press CTRL + W
Search – our_networks
4. Uncomment this lines
#acl our_networks src 192.168.1.0/24 192.168.2.0/24 //Remove # mark
#http_access allow our_networks //Remove # mark
5. Save (CTRL + O) and Exit (CTRL + X) file
6. Start the proxy service
#service squid start
#chkconfig squid on
Settings up proxy clients
The proxy client is an application that required internet through the proxy server
EX – Internet Explorer, Mozilla Firefox
Fire Fox
Edit --> Preferences --> Advanced --> Network --> Settings --> manually proxy configuration
http proxy : 192.168.2.101 port : 3128 // proxy server IP and port number
Now clients have to access internet through proxy………
Controlling web access through proxy
1. Open the following file
#nano /ect/squid/squid.conf
Press CTRL + W
Search – # http_access deny all
Put all the rules that you want to control web access through proxy under the above comment. All the block rules must come before the allow rules
• To block unwanted website
acl blockweb dstdomain .facebook.com .yahoo.com .google.com
http_access deny blockweb
• To block unwanted file download
acl blockfile urlpath_regex –i exe$ mp3$ avi$ rar$
http_access deny blockfile
• To allow POP3/ SMTP to access mail through proxy server
acl allowmail proto POP3 SMTP
http_access allow allowmail
2. Save (CTRL + O) and exit (CTRL +X) the file
3. Reload squid service
#service squid reload
---------------------------------------------------------
List of acl tags and examples
http://wiki.squid-cache.org
---------------------------------------------------------
What’s New in VMware vSphere 5.1?
vSphere 5.1 is VMware’s latest release of its industry-leading virtualization platform. This new release contains the following new features and enhancements:
Compute
• Larger virtual machines – Virtual machines can grow two times larger than in any previous release to support even the most advanced applications. Virtual machines can now have up to 64 virtual CPUs (vCPUs) and 1TB of virtual RAM (vRAM).
• New virtual machine format – New features in the virtual machine format (version 9) in vSphere 5.1 include support for larger virtual machines, CPU performance counters and virtual shared graphics acceleration designed for enhanced performance.
Storage
• Flexible, space-efficient storage for virtual desktop infrastructure (VDI) – A new disk format enables the correct balance between space efficiency and I/O throughput for the virtual desktop.
Network
• vSphere Distributed Switch – Enhancements such as Network Health Check, Configuration Backup and Restore, Roll Back and Recovery, and Link Aggregation Control Protocol support and deliver more enterprise-class networking functionality and a more robust foundation for cloud computing.
• Single-root I/O virtualization (SR-IOV) support – Support for SR-IOV optimizes performance for sophisticated applications.