Friday, December 2, 2011

Internet and Network Setting on NetBSD

There are about all step after installation NetBSD, If you don't know how to install NetBSD you can open this site. The configuration to connect the internet, please folow all steps bellow (you must login as root) :


Setting ethernet card and IP Address
type this command bello in your NetBSD terminal : 
# ifconfig lo0 127.0.0.1
# ifconfig ex0 (Your IP Address) netmask (Your Netmask) 
# route add default (Your router Address)
For Example :
# ifconfig lo0 127.0.0.1
# ifconfig ex0 10.122.1.99 netmask 255.255.255.0
# route add default 10.122.1.1

Add DNS
Let's open file /etc/resolv.conf using Vi editor :
# vi /etc/resolv.conf
then, add this :
nameserver (Your DNS Address) 
nameserver (Your Alternate DNS Address)
For Example :
nameserver 10.122.1.1 
nameserver 202.46.129.3

Setting proxy
First, knowing your Shell.
to check your Shell, use this command :
# echo $SHELL
if you use /bin/sh.
# cd
# vi .shrc
add this :
export http_proxy="http://username:password@host:port/"
export ftp_proxy=$http_proxy
if you use /bin/bash.
# cd
# ee .bashrc
add this :
export http_proxy="http://username:password@host:port/"
export ftp_proxy=$http_proxy
if you use /bin/csh.
# cd
# vi .cshrc
add this :
setenv http_proxy http://username:password@host:port/
setenv ftp_proxy=$http_proxy
Then, if that step about proxy setting above still dont work. You can set manually, one by one. But I recomend you to don't erase all configuration on your Shell, which you typed last time. Because it's used to set automatically after reboot or halt. Follow this command to set manually your proxy !

in /bin/bash and /bin/sh : 
# export http_proxy="http://username:password@host:port/" 
# export ftp_proxy=$http_proxy
in /bin/csh :
# setenv http_proxy http://username:password@host:port/
# setenv ftp_proxy=$http_proxy

Use PKGsrc
PKGsrc is same with Repository in Linux. To set your PKGsrc, you must know your Shell like proxy setting. Please follow this command below to add PKGsrc :
# echo $SHELL
if you use /bin/sh.
#cd
#vi .shrc
add  this:
PATH="/usr/pkg/sbin:$PATH"
PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/OPSYS/ARCH/VERSIONS/All"
export PATH PKG_PATH
if you use /bin/bash.
# cd
# ee .bashrc
add this :
PATH="/usr/pkg/sbin:$PATH"
PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/OPSYS/ARCH/VERSIONS/All"
export PATH PKG_PATH
if you use /bin/csh.
# cd
# vi .cshrc
add this :
PATH="/usr/pkg/sbin:$PATH"
PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/OPSYS/ARCH/VERSIONS/All"
setenv PATH PKG_PATH
Here, I used NetBSD version 5.1 and /bin/sh with AMD 64 Architecture. For Example in PKGsrc configuration : 
#cd
#vi .shrc 
add  this:  
PATH="/usr/pkg/sbin:$PATH"
PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/AMD64/5.1/All"
export PATH PKG_PATH
Then, if that step about PKGsrc above still dont work. You can set manually, one by one. But I recomend you to don't erase all configuration on your Shell, which you typed last time. Because it's used to set automatically after reboot or halt. Follow this command to set manually your PKGsrc !

in /bin/bash and /bin/sh : 
# PATH="/usr/pkg/sbin:$PATH"
# PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/OPSYS/ARCH/VERSIONS/All"
# export PATH PKG_PATH
in /bin/csh :
# PATH="/usr/pkg/sbin:$PATH"
# PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/OPSYS/ARCH/VERSIONS/All"
# setenv PATH PKG_PATH
Then, you can add some apps or tools in your NetBSD like this :
# pkg_add -v wget
# pkg_add -v gcc
... and all apps and tools.

No comments: