以太坊編程使用ubuntu
⑴ ubuntu檢測不到乙太網卡eth0……在終端使用命令建立連接時,第一步檢測乙太網卡就無法通過,
可以看看這個文章:
http://www.yyearth.com/article/14-04/network.html
⑵ ubuntu 裝ntop 我需要配置eth0和eth1兩塊網卡,如何進行設置
# ./ntop -P /var/ntop/ -i eth0 -u ntop 啟動服務
試一下吧
⑶ Linux下設置 IP,我看很多人都說用vi /etc/sysconfig/network-scripts/ifcfg-eth0
如果你確定你的/etc/下沒有sysconfig文件夾,那麼你應該裝的不是rh linux,有可能是其他版本的linux,例如ubuntu。
那你看看/etc/下面有沒有一個networks目錄。看看有沒有一個文件叫做interfaces.如果有就在這裡面配置。配置如下,假設你只有一塊網卡。
auto eth0
address 192.168.1.123
netmask 255.255.255.0
gateway 192.168.1.1
保存退出。重啟服務,執行: /etc/init.d/networking restart
⑷ 以太坊編程語言Serpent與Python的區別,有什麼優點
mps()函數執行和mp()函數相同的序列化。取代接受流對象並將序列化後的數據保存到磁碟文件,這個函數簡單的返回序列化的數據。
loads()函數執行和load()函數一樣的反序列化。取代接受一個流對象並去文件讀取序列化後的數據,它接受包含序列化後的數據的str對象, 直接返回的對象。
⑸ ubuntu 自動乙太網 eth0 問題 為什麼網路連接只能用自動乙太網 不能用eth0 啊 怎麼設置
描述不是很清楚額。
沒明白你的目的。
eth0是設備名。eh0連接的是乙太網絡。
如果你的意思說是連接不了網路的話。
要看你家的網路狀況而定
是ppoe還是isp給你的固定ip地址。
如果ppoe的話可以點擊鏈接的哪個地方對鏈接設備更改配置,需要輸入安裝時候你設置的密碼。然後添加ppoe
⑹ ubuntu怎麼設置乙太網
Ubuntu
$sudo vi /etc/network/interfaces
iface eth0 inet dhcp (自動獲取ip)
auto eth0
iface eth0 inet static
address 192.168.0.22 ip地址
netmask 255.255.255.0 子網掩碼
gateway 192.168.0.1 網關
$ sudo /etc/init.d/networking restart 重啟網路
dns 添加
sudo vim /etc/resolv.conf
nameserver 8.8.8.8
⑺ ubuntu14.04怎麼做個網關
案例. 僅供參考.
在CentOS 6, Ubuntu 14.04, Debian7, CentOS 5, RHEL 5/6都可用.
以下是我的具體案例, 請依據你的實際情況修改.
網路拓撲:
Gateway / NAT server,
eth0 --- public internet 59.72.122.110 netmask 255.255.255.0 gateway 59.72.122.254
eth1 --- private network 192.9.200.200 netmask 255.255.255.0 gateway 192.9.200.254
eth1 鏈接一個私有的交換機或者集線器, 其他的機器, 包括無線路由器, 鏈接該交換機或者集線器, 192.9.200.254是eth1所鏈接的交換機的網關地址.
在Gateway / NAT server上設定.
先設定Gateway / NAT server上的兩個網路.
#### The private network runs on interface eth1
#### The public network runs on interface eth0
EXTIF="eth0"
INIF="eth1"
export INIF EXTIF
### shutdown all interfaces.
ifconfig eth0 down
ifconfig eth1 down
ifconfig eth2 down
ifconfig eth3 down
### public
ifconfig $EXTIF hw ether 00:11:B0:19:89:64
ifconfig $EXTIF 59.72.122.110 netmask 255.255.255.0
### private
ifconfig $INIF 192.9.200.200 netmask 255.255.255.0
### Bring up the two interfaces
ifconfig $EXTIF up
ifconfig $INIF up
### configure the route table
route add -net 192.9.0.0 netmask 255.255.0.0 gw 192.9.200.254 dev $INIF
route add default gw 59.72.122.254 dev $EXTIF
####EOF
請酌情修改.
####BOF
#!/bin/bash
EXTIF="eth0"
INIF="eth1"
INNET="192.9.200.0/24"
export INIF EXTIF INNET
### For NAT Gateway
# Starting NAT Server
echo "1" > /proc/sys/net/ipv4/ip_forward
### Flush the original rules
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z
/sbin/iptables -F -t nat
/sbin/iptables -X -t nat
/sbin/iptables -Z -t nat
# Set Default Rules
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
### No extra control
### All Forward from the private INNET is allowed.
### Accept all the Forward request form $INIF
/sbin/iptables -A FORWARD -i $INIF -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
/sbin/iptables -t nat -A POSTROUTING -o $INIF -j MASQUERADE
### Forward chain
### Allow vpn client to access private network
/sbin/iptables -A FORWARD -i ppp+ -o $INIF -j ACCEPT
/sbin/iptables -A FORWARD -i $INIF -o ppp+ -j ACCEPT
### Allow vpn client to access pub network
/sbin/iptables -A FORWARD -i ppp+ -o $EXTIF -j ACCEPT
/sbin/iptables -A FORWARD -i $EXTIF -o ppp+ -j ACCEPT
###
# the following two lines Enable iptables work in High Efficiency
/sbin/iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
### EOF####
抱歉, 我不會使用ipbtale指令, 就寫了這個簡單的腳本, 開機自己運行.
如果你沒有vpn服務, 請忽略ppp+相關的設定.
如果你有其他安全要求, 請修改INPUT為DROP, 然後逐條開放.
客戶機上的設定:
IP和eth1保持一個地址段, 但是記得網關指定為Gateway /NAT server上的eth1的IP地址.
無線路由器上, 設定WLAN埠IP後, 指定網關是192.9.200.200, 在LAN上開啟DHCP.
其他台式機, 如何開啟DHCP, 我自己沒有處理, 我想你需要在Gateway /NAT server上開起DHCP服務就可以了.
但是記得要推送網關為你的eth1的IP地址.
⑻ linux嵌入式系統下編程修改ip mac地址,c語言程序,具體操作類似 ifconfig eth down ifconfig eth0 Up
#include <stdlib.h>int system(const char *string);例:在~/myprogram/目錄下有shell腳本test.sh,內容為#!bin/bash#test.shecho $HOME在該目錄下新建一個c文件systemtest.c,內容為:#include<stdlib.h>main(){
system("~/myprogram/test.sh");}執行結果如下:xiakeyou@ubuntu:~/myprogram$ gcc systemtest.c -o
systemtestxiakeyou@ubuntu:~/myprogram$ ./systemtest/home/d/e/xiakeyouxiakeyou@ubuntu:~/myprogram$2)popen(char *command,char *type)執行過程:popen()會調用fork()產生子進程,然後從子進程中調用/bin/sh
-c來執行參數command的指令。參數
type可使用「r」代表讀取,「w」代表寫入。依照此type值,popen()會建立管道連到子進程的標准輸出設備或標准輸入設備,然後返回一個文件
指針。隨後進程便可利用此文件指針來讀取子進程的輸出設備或是寫入到子進程的標准輸入設備中。此外,所有使用文件指針(FILE*)操作的函數也都可以使
用,除了fclose()以外。返回值:若成功則返迴文件指針,否則返回NULL,錯誤原因存於errno中。
注意:在編寫具SUID/SGID許可權的程序時請盡量避免使用popen(),popen()會繼承環境變數,通過環境變數可能會造成系統安全的問題。例:C程序popentest.c內容如下:#include<stdio.h>main(){FILE * fp;charbuffer[80];fp=popen(「~/myprogram/test.sh」,」r」);fgets(buffer,sizeof(buffer),fp);printf(「%s」,buffer);pclose(fp);}執行結果如下:xiakeyou@ubuntu:~/myprogram$ vim popentest.cxiakeyou@ubuntu:~/myprogram$ gcc popentest.c -o popentestxiakeyou@ubuntu:~/myprogram$ ./popentest/home/d/e/xiakeyouxiakeyou@ubuntu:~/myprogram$
只是偶能力可能有點有限,沒有太看懂。直接用system()倒是腳本可是執行,只是返回值卻是一塌糊塗,試了多次也沒有找到什麼規律。不免又看了一下上面的那篇博文,得到一些啟發,可以這樣來實現:先將腳本的返回值利用 echo > XXXXX 輸出到一個本地文件中當需要這個返回值是,可是通過C語言的文件操作函數來直接從文件中讀取後來一想,這應該就是上文中POPEN的實現方法!C程序調用shell腳本共有三種法子 :system()、popen()、exec系列函數 system()
不用你自己去產生進程,它已經封裝了,直接加入自己的命令exec 需要你自己 fork 進程,然後exec 自己的命令popen() 也可以實現執行你的命令,比system 開銷小1)system(shell命令或shell腳本路徑);system()會調用fork()產生 子歷程,由子歷程來調用/bin/sh-c string來履行
參數string字元串所代表的命令,此命令履行 完後隨即返回原調用的歷程。在調用system()期間SIGCHLD
信號會被暫時擱置,SIGINT和SIGQUIT 信號則會被漠視 。
返回值:如果system()在調用/bin/sh時失敗則返回127,其他失敗原因返回-1。若參數string為空指針(NULL),則返回非零值。
如果 system()調用成功 則最後會返回履行
shell命令後的返回值,但是此返回值也有可能為system()調用/bin/sh失敗所返回的127,因 此最好能再反省 errno
來確認履行 成功 。system命令以其簡略 高效的作用得到很很廣泛 的利用 ,下面是一個例子例:在~/test/目錄下有shell腳本test.sh,內容為#!bin/bash#test.shecho hello在同層目錄下新建一個c文件system_test.c,內容為:#include<stdlib.h>int main(){system("~/test/test.sh");}履行 效果 如下:[root@localhost test]$gcc system_test.c -o system_test[root@localhost test]$./system_testhello[root@localhost test]$2)popen(char *command,char *type)popen()會調用fork()產生 子歷程,然後從子歷程中調用/bin/sh -c來履行
參數command的指令。參數type可應用 「r」代表讀取,「w」代表寫入。遵循此type值,popen()會建立
管道連到子歷程的標准 輸出設備 或標准 輸入設備 ,然後返回一個文件指針。隨後歷程便可利用 此文件指針來讀取子歷程的輸出設備
或是寫入到子歷程的標准 輸入設備 中。此外,所有應用 文 件指針(FILE*)操作的函數也都可以應用
,除了fclose()以外。返回值:若成功 則返迴文件指針,否則返回NULL,差錯
原因存於errno中。注意:在編寫具SUID/SGID許可權的程序時請盡量避免應用popen(),popen()會繼承環境變數,通過環境變數可能會造成系統安全的問題。例:C程序popentest.c內容如下:#include<stdio.h>main{FILE * fp;charbuffer[80];fp=popen(「~/myprogram/test.sh」,」r」);fgets(buffer,sizeof(buffer),fp);printf(「%s」,buffer);pclose(fp);}履行 效果 如下:[root@localhost test]$ vim popentest.c[root@localhost test]$ gcc popentest.c -o popentest[root@localhost test]$ ./popentest/root/test[root@localhost test]$