Archive

Archive for December, 2011

Set static IP

December 30, 2011 Leave a comment

1. Disable Network Auto Magic — nwam

# svcadm nwam

# svcadm enable network/physical:default

2. View the network devices

# dladm show-phys
LINK         MEDIA                STATE      SPEED  DUPLEX    DEVICE
bge0         Ethernet             unknown    1000   full      bge0
# dladm show-link
LINK        CLASS     MTU    STATE    BRIDGE     OVER
bge0        phys      1500   unknown  --         --
# ipadm show-if
IFNAME     STATE    CURRENT      PERSISTENT
lo0        ok       -m-v------46 ---

3. Create and Configure a Logical Interface

# ipadm create-ip bge0
# dladm show-link
LINK        CLASS     MTU    STATE    BRIDGE     OVER
bge0        phys      1500   up       --         --
# ipadm show-if
IFNAME     STATE    CURRENT      PERSISTENT
lo0        ok       -m-v------46 ---
bge0       down     bm--------46 -46

4. Create and set DHCP IP

# ipadm create-addr -T dhcp bge0/v4
# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
bge0/v4           dhcp     ok           192.168.100.225/24
lo0/v6            static   ok           ::1/128

5. Delete DHCP IP

# ipadm delete-addr bge0/v4

6. Set static IP

# ipadm create-addr -T static -a 192.168.100.200/24 bge0/v4
# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
bge0/v4           static   ok           192.168.100.200/24
lo0/v6            static   ok           ::1/128

7. Verify settings

# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
bge0/v4           static   ok           192.168.100.200/24
lo0/v6            static   ok           ::1/128
# netstat -r

Routing Table: IPv4
Destination           Gateway           Flags  Ref     Use     Interface
-------------------- -------------------- ----- ----- ---------- ---------
solaris              solaris              UH        2          0 lo0
192.168.100.0        192.168.100.200      U         3          1 bge0

Routing Table: IPv6
Destination/Mask            Gateway                   Flags Ref   Use    If
--------------------------- --------------------------- ----- --- ------- -----
solaris                     solaris                     UH      2       4 lo0

8. Add a router

# route -p add default 192.168.100.1
add net default: gateway 192.168.100.1
add persistent net default: gateway 192.168.100.1

Once it has been corrected it should look something like this, and you should be able to ping off-net.

# netstat -r

Routing Table: IPv4
Destination           Gateway           Flags  Ref     Use     Interface
-------------------- -------------------- ----- ----- ---------- ---------
default              fw01.allanglesit.net UG        2      10466
solaris              solaris              UH        2         12 lo0
192.168.100.0        192.168.100.200      U         6       1810 bge0

Routing Table: IPv6
Destination/Mask            Gateway                   Flags Ref   Use    If
--------------------------- --------------------------- ----- --- ------- -----
solaris                     solaris                     UH      2     156 lo0

9. View DNS

# cat /etc/resolv.conf
domain  allanglesit.net
nameserver  192.168.100.22
nameserver  192.168.100.25
# dig www.google.com

11. View DNS search priority

# cat /etc/nsswitch.conf . hosts:      files dns ipnodes:    files dns

12. Reset system configure if all above not work
# sysconfig unconfigure
# init 6

Categories: network

CentOS install gcc/c/c++

December 25, 2011 Leave a comment

Under CentOS 6

1. Install with internet connection

# yum groupinstall 'Development Tools'

2. Install with local DVD

# yum --enablerepo=c6-media groupinstall Development Tools'

3. Kernel heads should be installed sometimes

# yum install kernel-devel*

Categories: cc

Which shell is currently log in

December 10, 2011 Leave a comment

If you want to figure out which is the current log in shell, try below:

1.  ps -p $$

2. echo $0

Categories: shell